Source:
protected void executeCommand() { entity = getGlusterHooksDao().getById(getParameters().getHookId(),true); addCustomValue(GlusterConstants.HOOK_NAME, entity.getName()); List <VDS> servers = getAllUpServers(getParameters().getClusterId()); List<GlusterServerHook> serverHooks = entity.getServerHooks(); if (servers.size() < getClusterUtils().getServerCount(getParameters().getClusterId())) { errors.add(VdcBllMessages.CLUSTER_ALL_SERVERS_NOT_UP.toString()); } List<Callable<Pair<VDS, VDSReturnValue>>> taskList = new ArrayList<Callable<Pair<VDS, VDSReturnValue>>>(); for (final VDS upServer : servers) { taskList.add(new Callable<Pair<VDS, VDSReturnValue>>() { @Override public Pair<VDS, VDSReturnValue> call() throws Exception { VDSReturnValue returnValue = runVdsCommand( getStatusChangeVDSCommand(), new GlusterHookVDSParameters(upServer.getId(), entity.getGlusterCommand(), entity.getStage(), entity.getName())); return new Pair<VDS, VDSReturnValue>(upServer, returnValue); } }); } boolean atLeastOneSuccess = false; List<Pair<VDS, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(taskList); for (Pair<VDS, VDSReturnValue> pairResult : pairResults) { VDSReturnValue retValue = pairResult.getSecond(); if (retValue.getSucceeded() || VdcBllErrors.GlusterHookAlreadyEnabled.equals(retValue.getVdsError().getCode())) { atLeastOneSuccess = true; addOrUpdateServerHook(serverHooks, pairResult); } else { errors.add(retValue.getVdsError().getMessage()); } } setSucceeded(atLeastOneSuccess); if (errors.size() > 0) { entity.addStatusConflict(); handleVdsErrors(getAuditLogTypeValue(), errors); addCustomValue("FailureMessage" , StringUtils.join(errors, SystemUtils.LINE_SEPARATOR)); } if (getSucceeded()) { entity.setStatus(getNewStatus()); updateHookInDb(entity); } }

Target:
protected void executeCommand() { entity = getGlusterHooksDao().getById(getParameters().getHookId(),true); addCustomValue(GlusterConstants.HOOK_NAME, entity.getName()); List <VDS> servers = getAllUpServers(getParameters().getClusterId()); List<GlusterServerHook> serverHooks = entity.getServerHooks(); if (servers.size() < getClusterUtils().getServerCount(getParameters().getClusterId())) { errors.add(VdcBllMessages.CLUSTER_ALL_SERVERS_NOT_UP.toString()); } List<Callable<Pair<VDS, VDSReturnValue>>> taskList = new ArrayList<Callable<Pair<VDS, VDSReturnValue>>>(); for (final VDS upServer : servers) { taskList.add(new Callable<Pair<VDS, VDSReturnValue>>() { @Override public Pair<VDS, VDSReturnValue> call() throws Exception { VDSReturnValue returnValue = runVdsCommand( getStatusChangeVDSCommand(), new GlusterHookVDSParameters(upServer.getId(), entity.getGlusterCommand(), entity.getStage(), entity.getName())); return new Pair<VDS, VDSReturnValue>(upServer, returnValue); } }); } boolean atLeastOneSuccess = false; List<Pair<VDS, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(taskList); for (Pair<VDS, VDSReturnValue> pairResult : pairResults) { VDSReturnValue retValue = pairResult.getSecond(); if (retValue.getSucceeded() || VdcBllErrors.GlusterHookAlreadyEnabled.equals(retValue.getVdsError().getCode())) { atLeastOneSuccess = true; addOrUpdateServerHook(serverHooks, pairResult); } else { errors.add(retValue.getVdsError().getMessage()); } } setSucceeded(atLeastOneSuccess); if (errors.size() > 0) { entity.addStatusConflict(); handleVdsErrors(getAuditLogTypeValue(), errors); addCustomValue(GlusterConstants.FAILURE_MESSAGE , StringUtils.join(errors, SystemUtils.LINE_SEPARATOR)); } if (getSucceeded()) { entity.setStatus(getNewStatus()); updateHookInDb(entity); } }