Martin Mucha has uploaded a new change for review. Change subject: core: MultipleActionsRunner refactor: extracted canRunActions method from execute() ......................................................................
core: MultipleActionsRunner refactor: extracted canRunActions method from execute() method execute() is overgrown and disallowing modifications in subclasses. There are Commands written in a way disallowing separating method calls of 'canDoAction'and 'execute'. Calling all 'canDoAction' methods prior to calling first 'execute' yields bad results, therefore, canDoAction have to be called prior to respective execute method. Change-Id: I4b8b3f5a53402b6ceb4dc66cb4f137d7882f6b9f Signed-off-by: Martin Mucha <mmu...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java 1 file changed, 19 insertions(+), 16 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/89/35189/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java index 834c82b..5d950db 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java @@ -73,22 +73,7 @@ } } - if (getCommands().size() == 1) { - CorrelationIdTracker.setCorrelationId(getCommands().get(0).getCorrelationId()); - returnValues.add(getCommands().get(0).canDoActionOnly()); - } else { - checkCanDoActionsAsynchronously(returnValues); - } - - boolean canRunActions = true; - if (isRunOnlyIfAllCanDoPass) { - for (VdcReturnValueBase value : returnValues) { - if (!value.getCanDoAction()) { - canRunActions = false; - break; - } - } - } + boolean canRunActions = canRunActions(returnValues); if (canRunActions) { if (isWaitForResult) { @@ -104,6 +89,24 @@ return returnValues; } + protected boolean canRunActions(ArrayList<VdcReturnValueBase> returnValues) { + if (getCommands().size() == 1) { + CorrelationIdTracker.setCorrelationId(getCommands().get(0).getCorrelationId()); + returnValues.add(getCommands().get(0).canDoActionOnly()); + } else { + checkCanDoActionsAsynchronously(returnValues); + } + + if (isRunOnlyIfAllCanDoPass) { + for (VdcReturnValueBase value : returnValues) { + if (!value.getCanDoAction()) { + return false; + } + } + } + return true; + } + /** * Check CanDoActions of all commands. We perform checks for all commands at * the same time the number of threads is managed by java -- To view, visit http://gerrit.ovirt.org/35189 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4b8b3f5a53402b6ceb4dc66cb4f137d7882f6b9f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Mucha <mmu...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches