Arik Hadas has uploaded a new change for review. Change subject: core: cleanup in CommandBase ......................................................................
core: cleanup in CommandBase 1. Move field declarations up to the beginning of the class 2. Change the style of comments on fields to more compact style 3. Rename isReleaseExecute field to releaseLocksAtEndOfExecute to conform the java standard and be more expressive Change-Id: I551e00b86f18b62f95828b14f5fe54280eea6bb0 Signed-off-by: Arik Hadas <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java 1 file changed, 16 insertions(+), 26 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/15886/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java index a0cfb1b..903af76 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java @@ -102,9 +102,8 @@ @SuppressWarnings("serial") public abstract class CommandBase<T extends VdcActionParametersBase> extends AuditLogableBase implements RollbackHandler, TransactionMethod<Object> { - /** - * Multiplier used to convert GB to bytes or vice versa. - */ + + /* Multiplier used to convert GB to bytes or vice versa. */ protected static final long BYTES_IN_GB = 1024 * 1024 * 1024; private static final Guid[] EMPTY_GUID_ARRAY = new Guid[0]; private T _parameters; @@ -114,17 +113,21 @@ private final List<Class<?>> validationGroups = new ArrayList<Class<?>>(); private final Guid commandId; private boolean quotaChanged = false; + private String _description = ""; + private TransactionScopeOption scope; + private TransactionScopeOption endActionScope; + private List<QuotaConsumptionParameter> consumptionParameters; + /** Indicates whether the acquired locks should be released after the execute method or not */ + private boolean releaseLocksAtEndOfExecute = true; + /** Object which is representing a lock that some commands will acquire */ + private EngineLock commandLock; protected Log log = LogFactory.getLog(getClass()); - /** - * The context defines how to monitor the command and handle its compensation - */ + /** The context defines how to monitor the command and handle its compensation */ private final CommandContext context = new CommandContext(); - /** - * A map contains the properties for describing the job - */ + /** A map contains the properties for describing the job */ protected Map<String, String> jobProperties; /** Handlers for performing the logical parts of the command */ @@ -286,10 +289,6 @@ public void setCompensationContext(CompensationContext compensationContext) { context.setCompensationContext(compensationContext); } - - private String _description = ""; - private TransactionScopeOption scope; - private TransactionScopeOption endActionScope; public VdcReturnValueBase canDoActionOnly() { setActionMessageParameters(); @@ -609,8 +608,6 @@ } } } - - private List<QuotaConsumptionParameter> consumptionParameters; protected List<QuotaConsumptionParameter> getQuotaConsumptionParameters() { @@ -1477,13 +1474,6 @@ } } - private boolean isReleaseExecute = true; - - /** - * Object which is representing a lock that some commands will acquire - */ - private EngineLock commandLock = null; - protected EngineLock getLock() { return commandLock; } @@ -1496,7 +1486,7 @@ LockIdNameAttribute annotation = getClass().getAnnotation(LockIdNameAttribute.class); boolean returnValue = true; if (annotation != null) { - isReleaseExecute = annotation.isReleaseAtEndOfExecute(); + releaseLocksAtEndOfExecute = annotation.isReleaseAtEndOfExecute(); if (!annotation.isWait()) { returnValue = acquireLockInternal(); } else { @@ -1514,8 +1504,8 @@ LockIdNameAttribute annotation = getClass().getAnnotation(LockIdNameAttribute.class); boolean returnValue = true; if (annotation != null) { - isReleaseExecute = annotation.isReleaseAtEndOfExecute(); - if (!isReleaseExecute) { + releaseLocksAtEndOfExecute = annotation.isReleaseAtEndOfExecute(); + if (!releaseLocksAtEndOfExecute) { returnValue = acquireLockInternal(); } } @@ -1584,7 +1574,7 @@ } private void freeLockExecute() { - if (isReleaseExecute || !getSucceeded()) { + if (releaseLocksAtEndOfExecute || !getSucceeded()) { freeLock(); } } -- To view, visit http://gerrit.ovirt.org/15886 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I551e00b86f18b62f95828b14f5fe54280eea6bb0 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Arik Hadas <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
