Ravi Nori has uploaded a new change for review. Change subject: engine : Use java naming conventions ......................................................................
engine : Use java naming conventions Use java naming conventions for method names instead of csharp naming convention Change-Id: I8ab86d97dbf1c94dd887c5ccc2a438a41ccd1f37 Bug-Url: https://bugzilla.redhat.com/1122639 Signed-off-by: Ravi Nori <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandAsyncTask.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/SPMAsyncTask.java 2 files changed, 60 insertions(+), 60 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/19/31219/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandAsyncTask.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandAsyncTask.java index e92181b..2150847 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandAsyncTask.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandAsyncTask.java @@ -31,7 +31,7 @@ private static final Map<Guid, CommandMultiAsyncTasks> _multiTasksByCommandIds = new HashMap<Guid, CommandMultiAsyncTasks>(); - public CommandMultiAsyncTasks GetCommandMultiAsyncTasks() { + public CommandMultiAsyncTasks getCommandMultiAsyncTasks() { CommandMultiAsyncTasks entityInfo = null; synchronized (_lockObject) { entityInfo = _multiTasksByCommandIds.get(getCommandId()); @@ -50,7 +50,7 @@ isNewCommandAdded = true; } - CommandMultiAsyncTasks entityInfo = GetCommandMultiAsyncTasks(); + CommandMultiAsyncTasks entityInfo = getCommandMultiAsyncTasks(); entityInfo.AttachTask(this); } @@ -70,21 +70,21 @@ @Override public void concreteStartPollingTask() { - CommandMultiAsyncTasks entityInfo = GetCommandMultiAsyncTasks(); + CommandMultiAsyncTasks entityInfo = getCommandMultiAsyncTasks(); entityInfo.StartPollingTask(getVdsmTaskId()); } @Override - protected void OnTaskEndSuccess() { - LogEndTaskSuccess(); - EndActionIfNecessary(); + protected void onTaskEndSuccess() { + logEndTaskSuccess(); + endActionIfNecessary(); } - private void EndActionIfNecessary() { - CommandMultiAsyncTasks entityInfo = GetCommandMultiAsyncTasks(); + private void endActionIfNecessary() { + CommandMultiAsyncTasks entityInfo = getCommandMultiAsyncTasks(); if (entityInfo == null) { log.warnFormat( - "CommandAsyncTask::EndActionIfNecessary: No info is available for entity '{0}', current task ('{1}') was probably created while other tasks were in progress, clearing task.", + "CommandAsyncTask::endActionIfNecessary: No info is available for entity '{0}', current task ('{1}') was probably created while other tasks were in progress, clearing task.", getCommandId(), getVdsmTaskId()); @@ -93,7 +93,7 @@ else if (entityInfo.ShouldEndAction()) { log.infoFormat( - "CommandAsyncTask::EndActionIfNecessary: All tasks of command '{0}' has ended -> executing 'endAction'", + "CommandAsyncTask::endActionIfNecessary: All tasks of command '{0}' has ended -> executing 'endAction'", getCommandId()); log.infoFormat( @@ -106,14 +106,14 @@ @SuppressWarnings("synthetic-access") @Override public void run() { - EndCommandAction(); + endCommandAction(); } }); } } - private void EndCommandAction() { - CommandMultiAsyncTasks entityInfo = GetCommandMultiAsyncTasks(); + private void endCommandAction() { + CommandMultiAsyncTasks entityInfo = getCommandMultiAsyncTasks(); VdcReturnValueBase vdcReturnValue = null; ExecutionContext context = null; boolean endActionRuntimeException = false; @@ -134,7 +134,7 @@ dbAsyncTask.getActionParameters().setImagesParameters(imagesParameters); try { - log.infoFormat("CommandAsyncTask::EndCommandAction [within thread] context: Attempting to endAction '{0}', executionIndex: '{1}'", + log.infoFormat("CommandAsyncTask::endCommandAction [within thread] context: Attempting to endAction '{0}', executionIndex: '{1}'", dbAsyncTask.getActionParameters().getCommandType(), dbAsyncTask.getActionParameters().getExecutionIndex()); @@ -159,7 +159,7 @@ catch (RuntimeException Ex2) { log.error( - "CommandAsyncTask::EndCommandAction [within thread]: An exception has been thrown (not related to 'endAction' itself)", + "CommandAsyncTask::endCommandAction [within thread]: An exception has been thrown (not related to 'endAction' itself)", Ex2); endActionRuntimeException = true; } @@ -195,7 +195,7 @@ "CommandAsyncTask::HandleEndActionResult: endAction for action type '{0}' threw an unrecoverable RuntimeException the task will be cleared.", actionType); commandInfo.clearTaskByVdsmTaskId(dbAsyncTask.getVdsmTaskId()); - RemoveTaskFromDB(); + removeTaskFromDB(); if (commandInfo.getAllCleared()) { log.infoFormat( "CommandAsyncTask::HandleEndActionRuntimeException: Removing CommandMultiAsyncTasks object for entity '{0}'", @@ -261,15 +261,15 @@ } @Override - protected void OnTaskEndFailure() { - LogEndTaskFailure(); - EndActionIfNecessary(); + protected void onTaskEndFailure() { + logEndTaskFailure(); + endActionIfNecessary(); } @Override - protected void OnTaskDoesNotExist() { - LogTaskDoesntExist(); - EndActionIfNecessary(); + protected void onTaskDoesNotExist() { + logTaskDoesntExist(); + endActionIfNecessary(); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/SPMAsyncTask.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/SPMAsyncTask.java index 8a48cfd..0b9a4bd 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/SPMAsyncTask.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/SPMAsyncTask.java @@ -171,19 +171,19 @@ switch (getState()) { case Polling: // Get the returned task - returnTaskStatus = CheckTaskExist(returnTaskStatus); + returnTaskStatus = checkTaskExist(returnTaskStatus); if (returnTaskStatus.getStatus() != getLastTaskStatus().getStatus()) { - AddLogStatusTask(returnTaskStatus); + addLogStatusTask(returnTaskStatus); } setLastTaskStatus(returnTaskStatus); if (!getLastTaskStatus().getTaskIsRunning()) { - HandleEndedTask(); + handleEndedTask(); } break; case Ended: - HandleEndedTask(); + handleEndedTask(); break; // Try to clear task which failed to be cleared before SPM and DB @@ -211,7 +211,7 @@ * Handle ended task operation. Change task state to Ended ,Cleared or * Cleared Failed , and log appropriate message. */ - private void HandleEndedTask() { + private void handleEndedTask() { // If task state is different from Ended change it to Ended and set the // last access time to now. if (getState() != AsyncTaskState.Ended) { @@ -224,73 +224,73 @@ if (isPartiallyCompletedCommandTask()) { getParameters().getDbAsyncTask().getTaskParameters().setTaskGroupSuccess(false); ExecutionHandler.endTaskStep(privateParameters.getDbAsyncTask().getStepId(), JobExecutionStatus.FAILED); - OnTaskEndFailure(); + onTaskEndFailure(); } - if (HasTaskEndedSuccessfully()) { + if (hasTaskEndedSuccessfully()) { ExecutionHandler.endTaskStep(privateParameters.getDbAsyncTask().getStepId(), JobExecutionStatus.FINISHED); - OnTaskEndSuccess(); + onTaskEndSuccess(); } - else if (HasTaskEndedInFailure()) { + else if (hasTaskEndedInFailure()) { ExecutionHandler.endTaskStep(privateParameters.getDbAsyncTask().getStepId(), JobExecutionStatus.FAILED); - OnTaskEndFailure(); + onTaskEndFailure(); } - else if (!DoesTaskExist()) { + else if (!doesTaskExist()) { ExecutionHandler.endTaskStep(privateParameters.getDbAsyncTask().getStepId(), JobExecutionStatus.UNKNOWN); - OnTaskDoesNotExist(); + onTaskDoesNotExist(); } } - protected void RemoveTaskFromDB() { + protected void removeTaskFromDB() { try { if (coco.removeByVdsmTaskId(getVdsmTaskId()) != 0) { - log.infoFormat("BaseAsyncTask::RemoveTaskFromDB: Removed task {0} from DataBase", getVdsmTaskId()); + log.infoFormat("BaseAsyncTask::removeTaskFromDB: Removed task {0} from DataBase", getVdsmTaskId()); } } catch (RuntimeException e) { log.error(String.format( - "BaseAsyncTask::RemoveTaskFromDB: Removing task %1$s from DataBase threw an exception.", + "BaseAsyncTask::removeTaskFromDB: Removing task %1$s from DataBase threw an exception.", getVdsmTaskId()), e); } } - private boolean HasTaskEndedSuccessfully() { + private boolean hasTaskEndedSuccessfully() { return getLastTaskStatus().getTaskEndedSuccessfully(); } - private boolean HasTaskEndedInFailure() { + private boolean hasTaskEndedInFailure() { return !getLastTaskStatus().getTaskIsRunning() && !getLastTaskStatus().getTaskEndedSuccessfully(); } - private boolean DoesTaskExist() { + private boolean doesTaskExist() { return getLastTaskStatus().getStatus() != AsyncTaskStatusEnum.unknown; } - protected void OnTaskEndSuccess() { - LogEndTaskSuccess(); + protected void onTaskEndSuccess() { + logEndTaskSuccess(); clearAsyncTask(); } - protected void LogEndTaskSuccess() { + protected void logEndTaskSuccess() { log.infoFormat( - "BaseAsyncTask::OnTaskEndSuccess: Task '{0}' (Parent Command {1}, Parameters Type {2}) ended successfully.", + "BaseAsyncTask::onTaskEndSuccess: Task '{0}' (Parent Command {1}, Parameters Type {2}) ended successfully.", getVdsmTaskId(), (getParameters().getDbAsyncTask().getaction_type()), getParameters() .getClass().getName()); } - protected void OnTaskEndFailure() { - LogEndTaskFailure(); + protected void onTaskEndFailure() { + logEndTaskFailure(); clearAsyncTask(); } - protected void LogEndTaskFailure() { + protected void logEndTaskFailure() { log.errorFormat( - "BaseAsyncTask::LogEndTaskFailure: Task '{0}' (Parent Command {1}, Parameters Type {2}) ended with failure:" + "BaseAsyncTask::logEndTaskFailure: Task '{0}' (Parent Command {1}, Parameters Type {2}) ended with failure:" + "\r\n" + "-- Result: '{3}'" + "\r\n" + "-- Message: '{4}'," + "\r\n" + "-- Exception: '{5}'", getVdsmTaskId(), (getParameters().getDbAsyncTask().getaction_type()), @@ -302,14 +302,14 @@ .getException() == null ? "[null]" : getLastTaskStatus().getException().getMessage())); } - protected void OnTaskDoesNotExist() { - LogTaskDoesntExist(); + protected void onTaskDoesNotExist() { + logTaskDoesntExist(); clearAsyncTask(); } - protected void LogTaskDoesntExist() { + protected void logTaskDoesntExist() { log.errorFormat( - "BaseAsyncTask::LogTaskDoesntExist: Task '{0}' (Parent Command {1}, Parameters Type {2}) does not exist.", + "BaseAsyncTask::logTaskDoesntExist: Task '{0}' (Parent Command {1}, Parameters Type {2}) does not exist.", getVdsmTaskId(), (getParameters().getDbAsyncTask().getaction_type()), getParameters() @@ -323,7 +323,7 @@ * @param cachedStatusTask The status from the SPM, or <code>null</code> is the task wasn't found in the SPM. * @return - Updated status task */ - protected AsyncTaskStatus CheckTaskExist(AsyncTaskStatus cachedStatusTask) { + protected AsyncTaskStatus checkTaskExist(AsyncTaskStatus cachedStatusTask) { AsyncTaskStatus returnedStatusTask = null; // If the cachedStatusTask is null ,that means the task has not been found in the SPM. @@ -347,7 +347,7 @@ * @param cachedStatusTask * - Status got from VDSM */ - protected void AddLogStatusTask(AsyncTaskStatus cachedStatusTask) { + protected void addLogStatusTask(AsyncTaskStatus cachedStatusTask) { String formatString = "SPMAsyncTask::PollTask: Polling task '{0}' (Parent Command {1}, Parameters Type {2}) " + "returned status '{3}'{4}."; @@ -417,7 +417,7 @@ // to vdsm there is no need to clear the task. The task is just deleted // from the database if (Guid.Empty.equals(getVdsmTaskId())) { - RemoveTaskFromDB(); + removeTaskFromDB(); return; } clearAsyncTask(false); @@ -440,7 +440,7 @@ if (!isTaskStateError(vdsReturnValue)) { if (vdsReturnValue == null || !vdsReturnValue.getSucceeded()) { setState(AsyncTaskState.ClearFailed); - OnTaskCleanFailure(); + onTaskCleanFailure(); } else { setState(AsyncTaskState.Cleared); shouldGracefullyDeleteTask = true; @@ -448,7 +448,7 @@ } //A task should be removed from DB if forceDelete is set to true, or if it was cleared successfully. if (shouldGracefullyDeleteTask || forceDelete) { - RemoveTaskFromDB(); + removeTaskFromDB(); } } @@ -472,11 +472,11 @@ return false; } - protected void OnTaskCleanFailure() { - LogTaskCleanFailure(); + protected void onTaskCleanFailure() { + logTaskCleanFailure(); } - protected void LogTaskCleanFailure() { + protected void logTaskCleanFailure() { log.errorFormat("SPMAsyncTask::ClearAsyncTask: Clearing task '{0}' failed.", getVdsmTaskId()); } -- To view, visit http://gerrit.ovirt.org/31219 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8ab86d97dbf1c94dd887c5ccc2a438a41ccd1f37 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Ravi Nori <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
