Source:
public void invokeCallbackMethods() { initCommandExecutor(); Iterator<Entry<Guid, CommandContainer>> iterator = cmdCallbackMap.entrySet().iterator(); while (iterator.hasNext()) { Entry<Guid, CommandContainer> entry = iterator.next(); if (--entry.getValue().executionCountdown > 1) { continue; } Guid cmdId = entry.getKey(); CommandCallback callback = entry.getValue().callback; CommandStatus status = coco.getCommandStatus(cmdId); boolean errorInCallback = false; try { switch (status) { case FAILED: callback.onFailed(cmdId, coco.getChildCommandIds(cmdId)); break; case SUCCEEDED: callback.onSucceeded(cmdId, coco.getChildCommandIds(cmdId)); break; case ACTIVE: if (coco.getCommandEntity(cmdId).isExecuted()) { callback.doPolling(cmdId, coco.getChildCommandIds(cmdId)); } break; default: break; } } catch (Exception ex) { errorInCallback = true; handleError(ex, status, cmdId); } finally { if (CommandStatus.FAILED.equals(status) || (CommandStatus.SUCCEEDED.equals(status) && !errorInCallback)) { coco.updateCallbackNotified(cmdId); iterator.remove(); Guid rootCommandId = coco.getCommandEntity(entry.getKey()).getRootCommandId(); if (!Guid.Empty.equals(rootCommandId) && cmdCallbackMap.containsKey(rootCommandId)) { cmdCallbackMap.get(rootCommandId).executionDelay = 1; cmdCallbackMap.get(rootCommandId).executionCountdown = 1; } } else if (status != coco.getCommandStatus(cmdId)) { entry.getValue().executionDelay = 1; entry.getValue().executionCountdown = 1; } else { int maxDelay = Config.<Integer>getValue(ConfigValues.AsyncCommandPollingRateInSeconds); entry.getValue().executionDelay = Math.min(maxDelay, entry.getValue().executionDelay * 2); entry.getValue().executionCountdown = entry.getValue().executionDelay; } } } }

Target:
public void invokeCallbackMethods() { initCommandExecutor(); Iterator<Entry<Guid, CommandContainer>> iterator = cmdCallbackMap.entrySet().iterator(); while (iterator.hasNext()) { Entry<Guid, CommandContainer> entry = iterator.next(); if (--entry.getValue().executionCountdown > 0) { continue; } Guid cmdId = entry.getKey(); CommandCallback callback = entry.getValue().callback; CommandStatus status = coco.getCommandStatus(cmdId); boolean errorInCallback = false; try { switch (status) { case FAILED: callback.onFailed(cmdId, coco.getChildCommandIds(cmdId)); break; case SUCCEEDED: callback.onSucceeded(cmdId, coco.getChildCommandIds(cmdId)); break; case ACTIVE: if (coco.getCommandEntity(cmdId).isExecuted()) { callback.doPolling(cmdId, coco.getChildCommandIds(cmdId)); } break; default: break; } } catch (Exception ex) { errorInCallback = true; handleError(ex, status, cmdId); } finally { if (CommandStatus.FAILED.equals(status) || (CommandStatus.SUCCEEDED.equals(status) && !errorInCallback)) { coco.updateCallbackNotified(cmdId); iterator.remove(); Guid rootCommandId = coco.getCommandEntity(entry.getKey()).getRootCommandId(); if (!Guid.isNullOrEmpty(rootCommandId) && cmdCallbackMap.containsKey(rootCommandId)) { cmdCallbackMap.get(rootCommandId).executionDelay = 1; cmdCallbackMap.get(rootCommandId).executionCountdown = 1; } } else if (status != coco.getCommandStatus(cmdId)) { entry.getValue().executionDelay = 1; entry.getValue().executionCountdown = 1; } else { int maxDelay = Config.<Integer>getValue(ConfigValues.AsyncCommandPollingRateInSeconds); entry.getValue().executionDelay = Math.min(maxDelay, entry.getValue().executionDelay * 2); entry.getValue().executionCountdown = entry.getValue().executionDelay; } } } }