use of edu.iu.dsc.tws.comms.dfw.io.ReceiverState in project twister2 by DSC-SPIDAL.
the class DPartitionBatchFinalReceiver method progress.
@Override
public boolean progress() {
if (lock.tryLock()) {
try {
boolean needFurtherProgress = false;
for (int i = 0; i < targetsArray.length; i++) {
int target = targetsArray[i];
Shuffle sorts = sortedMergers.get(target);
sorts.run();
ReceiverState state = targetStates.get(target);
if (state != ReceiverState.SYNCED) {
needFurtherProgress = true;
}
}
if (!needFurtherProgress) {
return needFurtherProgress;
}
for (int i = 0; i < finishedTargets.size(); i++) {
int target = finishedTargets.get(i);
if (!finishedTargetsCompleted.contains(target) && partition.isDelegateComplete()) {
finishTarget(target);
targetStates.put(target, ReceiverState.SYNCED);
onSyncEvent(target, null);
finishedTargetsCompleted.add(target);
}
}
} finally {
lock.unlock();
}
}
complete = finishedTargetsCompleted.size() == targets.size();
return !complete;
}
Aggregations