Optimize based on review comments

appm_improvement
Charitha Goonetilleke 10 months ago
parent 5d69d08100
commit d2ad8ac579

@ -89,22 +89,22 @@ public class OperationTimeoutTask extends RandomlyAssignedScheduleTask {
List<Activity> activities = DeviceManagementDataHolder.getInstance().getOperationManager() List<Activity> activities = DeviceManagementDataHolder.getInstance().getOperationManager()
.getActivities(deviceTypes, operationTimeoutConfig.getCode(), timeMillis, .getActivities(deviceTypes, operationTimeoutConfig.getCode(), timeMillis,
operationTimeoutConfig.getInitialStatus()); operationTimeoutConfig.getInitialStatus());
String operationId;
Operation operation;
for (Activity activity : activities) { for (Activity activity : activities) {
operationId = activity.getActivityId().replace("ACTIVITY_", "");
for (ActivityStatus activityStatus : activity.getActivityStatus()) { for (ActivityStatus activityStatus : activity.getActivityStatus()) {
String operationId = activity.getActivityId().replace("ACTIVITY_", ""); operation = DeviceManagementDataHolder.getInstance().getOperationManager()
Operation operation = DeviceManagementDataHolder.getInstance().getOperationManager()
.getOperation(Integer.parseInt(operationId)); .getOperation(Integer.parseInt(operationId));
operation.setStatus(Operation.Status.valueOf(operationTimeoutConfig.getNextStatus())); operation.setStatus(Operation.Status.valueOf(operationTimeoutConfig.getNextStatus()));
DeviceManagementDataHolder.getInstance().getOperationManager() DeviceManagementDataHolder.getInstance().getOperationManager()
.updateOperation(activityStatus.getDeviceIdentifier(), operation); .updateOperation(activityStatus.getDeviceIdentifier(), operation);
} }
} }
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String msg = "Error occurred while retrieving operations."; String msg = "Error occurred while retrieving operations.";
log.error(msg, e); log.error(msg, e);
} }
} }
} }

Loading…
Cancel
Save