Skip to content

Commit

Permalink
computeNext() should not cause a side-effect in the normal case
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlatombe committed Aug 25, 2023
1 parent a2ff520 commit 4521fef
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,15 @@ public FlowExecutionList() {
*/
@Override
public Iterator<FlowExecution> iterator() {
return new AbstractIterator<FlowExecution>() {
return new AbstractIterator<>() {
final Iterator<FlowExecutionOwner> base = runningTasks.iterator();

@Override
protected FlowExecution computeNext() {
while (base.hasNext()) {
FlowExecutionOwner o = base.next();
try {
FlowExecution e = o.get();
if (e.isComplete()) {
unregister(o);
} else {
return e;
}
return o.get();
} catch (Throwable e) {
LOGGER.log(Level.FINE, "Failed to load " + o + ". Unregistering", e);
unregister(o);
Expand Down

0 comments on commit 4521fef

Please sign in to comment.