Moti Asayag has posted comments on this change. Change subject: core: introduce context pattern ......................................................................
Patch Set 40: (4 comments) thanks for incorporating the comments. added a comment on CommandContext.java http://gerrit.ovirt.org/#/c/28829/40/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachUserToVmFromPoolAndRunCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachUserToVmFromPoolAndRunCommand.java: Line 211: runVmParams.setParentCommand(VdcActionType.AttachUserToVmFromPoolAndRun); Line 212: runVmParams.setRunAsStateless(true); Line 213: ExecutionContext runVmContext = createRunVmContext(); Line 214: VdcReturnValueBase vdcReturnValue = runInternalAction(VdcActionType.RunVm, Line 215: runVmParams, dupContext().withExecutionContext(runVmContext).withtLock(null).withCompensationContext(null)); please use withoutLock() instead of withtLock(null) Line 216: Line 217: getTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); Line 218: setSucceeded(vdcReturnValue.getSucceeded()); Line 219: setActionReturnValue(vmToAttach); Line 245: protected void endSuccessfully() { Line 246: if (getVm() != null) { Line 247: if (DbFacade.getInstance().getSnapshotDao().exists(getVm().getId(), SnapshotType.STATELESS)) { Line 248: setSucceeded(Backend.getInstance().endAction(VdcActionType.RunVm, Line 249: getParameters().getImagesParameters().get(0), dupContext().withtLock(null).withExecutionContext(null)).getSucceeded()); same Line 250: Line 251: if (!getSucceeded()) { Line 252: log.warn("EndSuccessfully: endAction of RunVm failed, detaching user from Vm"); Line 253: detachUserFromVmFromPool(); // just in case. Line 273: @Override Line 274: protected void endWithFailure() { Line 275: setSucceeded(Backend.getInstance().endAction(VdcActionType.RunVm, Line 276: getParameters().getImagesParameters().get(0), Line 277: dupContext().withExecutionContext(null).withtLock(null)).getSucceeded()); same Line 278: if (!getSucceeded()) { Line 279: log.warn("AttachUserToVmFromPoolAndRunCommand::EndWitFailure: endAction of RunVm Failed"); Line 280: } Line 281: detachUserFromVmFromPool(); http://gerrit.ovirt.org/#/c/28829/40/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/context/CommandContext.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/context/CommandContext.java: Line 48: return this; Line 49: } Line 50: Line 51: public CommandContext withoutCompensationContext() { Line 52: return withCompensationContext(new DefaultCompensationContext()); shouldn't it be return withCompensationContext(new *NoOpCompensationContext*()) or even return withCompensationContext(NoOpCompensationContext.getInstance()) Line 53: } Line 54: Line 55: public CompensationContext getCompensationContext() { Line 56: return compensationContext; -- To view, visit http://gerrit.ovirt.org/28829 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I310f5f77fff78b3232ee77fe63791425fd521516 Gerrit-PatchSet: 40 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <[email protected]> Gerrit-Reviewer: Alon Bar-Lev <[email protected]> Gerrit-Reviewer: Arik Hadas <[email protected]> Gerrit-Reviewer: Moti Asayag <[email protected]> Gerrit-Reviewer: Omer Frenkel <[email protected]> Gerrit-Reviewer: Oved Ourfali <[email protected]> Gerrit-Reviewer: Piotr Kliczewski <[email protected]> Gerrit-Reviewer: Ravi Nori <[email protected]> Gerrit-Reviewer: Roy Golan <[email protected]> Gerrit-Reviewer: Tal Nisan <[email protected]> Gerrit-Reviewer: Yair Zaslavsky <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
