Source:
<code>public void StartPollingTask(Guid TaskID) { synchronized (_listTasks) { if (_listTasks.containsKey(TaskID) && _listTasks.get(TaskID).getParameters() != null && _listTasks.get(TaskID).getParameters().getDbAsyncTask() != null) { if (getActionType() == VdcActionType.Unknown) { setActionType(_listTasks.get(TaskID).getParameters().getDbAsyncTask().getaction_type()); log.infoFormat( "EntityMultiAsyncTasks::StartPollingTask: Current Action Type for entity '{0}' is '{1}' (determined by task '{2}')", getContainerId(), getActionType(), TaskID); for (EntityAsyncTask task : _listTasks.values()) { if (task.getParameters() != null && task.getParameters().getDbAsyncTask() != null && task.getParameters().getDbAsyncTask().getaction_type() == getActionType() && (task.getState() == AsyncTaskState.Initializing || task.getState() == AsyncTaskState.WaitForPoll)) { <START> log.debugFormat("Task id {0} Changed its task state from {1} to polling.", <END> task.getTaskID(), task.getState()); task.setState(AsyncTaskState.Polling); } } } else { VdcActionType currTaskActionType = _listTasks.get(TaskID).getParameters().getDbAsyncTask() .getaction_type(); for (EntityAsyncTask task : _listTasks.values()) { if (task.getParameters() != null && task.getParameters().getDbAsyncTask() != null && task.getParameters().getDbAsyncTask().getaction_type() == currTaskActionType && task.getState() == AsyncTaskState.Initializing) { log.debugFormat("Task id {0} Changed its task state from {1} to wait for poll.", task.getTaskID(), task.getState()); task.setState(AsyncTaskState.WaitForPoll); } } } } else { log.warnFormat( "EntityMultiAsyncTasks::StartPollingTask: For some reason, task '{0}' has no parameters or no DB task - we don't know its action type", TaskID); } } }</code><technical_language>I enum state instead of polling. aligned state for encapsulation sake. Also: s/Changed/changed, s/task state/state. some duplicity in second</technical_language>

Target:
public void StartPollingTask(Guid TaskID) { synchronized (_listTasks) { if (_listTasks.containsKey(TaskID) && _listTasks.get(TaskID).getParameters() != null && _listTasks.get(TaskID).getParameters().getDbAsyncTask() != null) { if (getActionType() == VdcActionType.Unknown) { setActionType(_listTasks.get(TaskID).getParameters().getDbAsyncTask().getaction_type()); log.infoFormat( "EntityMultiAsyncTasks::StartPollingTask: Current Action Type for entity '{0}' is '{1}' (determined by task '{2}')", getContainerId(), getActionType(), TaskID); for (EntityAsyncTask task : _listTasks.values()) { if (task.getParameters() != null && task.getParameters().getDbAsyncTask() != null && task.getParameters().getDbAsyncTask().getaction_type() == getActionType() && (task.getState() == AsyncTaskState.Initializing || task.getState() == AsyncTaskState.WaitForPoll)) { log.debugFormat("Task id {0} changed its state from {1} to {2}.", task.getTaskID(), task.getState(), AsyncTaskState.Polling); task.setState(AsyncTaskState.Polling); } } } else { VdcActionType currTaskActionType = _listTasks.get(TaskID).getParameters().getDbAsyncTask() .getaction_type(); for (EntityAsyncTask task : _listTasks.values()) { if (task.getParameters() != null && task.getParameters().getDbAsyncTask() != null && task.getParameters().getDbAsyncTask().getaction_type() == currTaskActionType && task.getState() == AsyncTaskState.Initializing) { log.debugFormat("Task id {0} changed its state from {1} to wait for {2}.", task.getTaskID(), task.getState(), AsyncTaskState.WaitForPoll); task.setState(AsyncTaskState.WaitForPoll); } } } } else { log.warnFormat( "EntityMultiAsyncTasks::StartPollingTask: For some reason, task '{0}' has no parameters or no DB task - we don't know its action type", TaskID); } } }