Ravi Nori has uploaded a new change for review. Change subject: engine : CommandExecutor should handle exception in CallBackMethods ......................................................................
engine : CommandExecutor should handle exception in CallBackMethods If one of the callback methods raises an exception, the framework keeps calling the method again the next loop iteration. In some circumstances this means the command will never converge--e.g. coding errors, database connection failures, etc. Change-Id: I06b82f29ac31fd09903d76f87e839d8ac32ef1e1 Bug-Url: https://bugzilla.redhat.com/1121237 Signed-off-by: Ravi Nori <rn...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java 1 file changed, 30 insertions(+), 15 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/63/30463/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java index 9623c7f..b551158 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java @@ -56,21 +56,36 @@ CommandStatus status = coco.getCommandStatus(cmdId); switch (status) { - case FAILED: - callBack.onFailed(cmdId, coco.getChildCommandIds(cmdId)); - coco.updateCallBackNotified(cmdId); - iterator.remove(); - break; - case SUCCEEDED: - callBack.onSucceeded(cmdId, coco.getChildCommandIds(cmdId)); - coco.updateCallBackNotified(cmdId); - iterator.remove(); - break; - case ACTIVE_ASYNC_EXECUTED: - callBack.doPolling(cmdId, coco.getChildCommandIds(cmdId)); - break; - default: - break; + case FAILED: + try { + callBack.onFailed(cmdId, coco.getChildCommandIds(cmdId)); + } catch (Exception ex) { + log.errorFormat("Error invoking onFailed for FAILED command {0}", cmdId.toString()); + } + coco.updateCallBackNotified(cmdId); + iterator.remove(); + break; + case SUCCEEDED: + try { + callBack.onSucceeded(cmdId, coco.getChildCommandIds(cmdId)); + } catch (Exception ex) { + log.errorFormat("Error invoking onSucceeded for SUCCEEDED command {0}", cmdId.toString()); + } + coco.updateCallBackNotified(cmdId); + iterator.remove(); + break; + case ACTIVE_ASYNC_EXECUTED: + try { + callBack.doPolling(cmdId, coco.getChildCommandIds(cmdId)); + } catch (Exception ex) { + // an unexpected error in doPolling has occurred, we fail the command + // so doPolling is not called invoked over and over again + coco.retrieveCommand(cmdId).setCommandStatus(CommandStatus.FAILED); + log.errorFormat("Error invoking doPooling for active command {0}", cmdId.toString()); + } + break; + default: + break; } } } -- To view, visit http://gerrit.ovirt.org/30463 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I06b82f29ac31fd09903d76f87e839d8ac32ef1e1 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Ravi Nori <rn...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches