INNER CODE UNIT · Java
rebalance
RuedigerMoeller/kontraktor · attic/ElasticScheduler.java:377
public void rebalance(DispatcherThread dispatcherThread) {
synchronized (balanceLock) {
DispatcherThread minLoadThread = assignDispatcher(dispatcherThread.getLoad());
if (minLoadThread == null || minLoadThread == dispatcherThread) {
return;
}
int qSizes = dispatcherThread.getAccumulatedQSizes();
// move actors
Actor[] qList = dispatcherThread.getActors();
long otherQSizes = minLoadThread.getAccumulatedQSizes();
if (4*otherQSizes/3>qSizes) {
if (REALLY_DEBUG_SCHEDULING) {
Log.Info(this, "no payoff, skip rebalance load:"+qSizes+" other:"+otherQSizes);
}
return;
}
for (int i = 0; i < qList.length; i++) {
Actor actor = qList[i];