@Override public synchronized void setRestartInstanceRequest(String serviceName, long startTimeMs, long endTimeMs, boolean isSuccess, int instanceId) { Preconditions.checkNotNull(serviceName, "Service name should not be null."); Preconditions.checkArgument(instanceId >= 0, "Instance id has to be greater than or equal to zero."); RestartStatus status = isSuccess ? RestartStatus.SUCCESS : RestartStatus.FAILURE; RestartServiceInstancesStatus restartStatus = new RestartServiceInstancesStatus(serviceName, startTimeMs, endTimeMs, status, ImmutableSet.of(instanceId)); String toJson = GSON.toJson(restartStatus, RestartServiceInstancesStatus.class); table.put(Bytes.toBytes(serviceName + "-restart"), Bytes.toBytes(toJson)); }
@Override public synchronized void setRestartInstanceRequest(String serviceName, long startTimeMs, long endTimeMs, boolean isSuccess, int instanceId) { Preconditions.checkNotNull(serviceName, "Service name should not be null."); Preconditions.checkArgument(instanceId >= 0, "Instance id has to be greater than or equal to zero."); RestartStatus status = isSuccess ? RestartStatus.SUCCESS : RestartStatus.FAILURE; RestartServiceInstancesStatus restartStatus = new RestartServiceInstancesStatus(serviceName, startTimeMs, endTimeMs, status, ImmutableSet.of(instanceId)); String toJson = GSON.toJson(restartStatus, RestartServiceInstancesStatus.class); table.put(Bytes.toBytes(serviceName + "-restart"), Bytes.toBytes(toJson)); }
@Override public synchronized void setRestartAllInstancesRequest(String serviceName, long startTimeMs, long endTimeMs, boolean isSuccess) { Preconditions.checkNotNull(serviceName, "Service name should not be null."); RestartStatus status = isSuccess ? RestartStatus.SUCCESS : RestartStatus.FAILURE; Integer serviceInstance = getServiceInstance(serviceName); int instanceCount = (serviceInstance == null) ? 0 : serviceInstance; Set<Integer> instancesToRestart = Ranges.closedOpen(0, instanceCount).asSet(DiscreteDomains.integers()); RestartServiceInstancesStatus restartStatus = new RestartServiceInstancesStatus(serviceName, startTimeMs, endTimeMs, status, instancesToRestart); String toJson = GSON.toJson(restartStatus, RestartServiceInstancesStatus.class); table.put(Bytes.toBytes(serviceName + "-restart"), Bytes.toBytes(toJson)); }
@Override public synchronized void setRestartAllInstancesRequest(String serviceName, long startTimeMs, long endTimeMs, boolean isSuccess) { Preconditions.checkNotNull(serviceName, "Service name should not be null."); RestartStatus status = isSuccess ? RestartStatus.SUCCESS : RestartStatus.FAILURE; Integer serviceInstance = getServiceInstance(serviceName); int instanceCount = (serviceInstance == null) ? 0 : serviceInstance; Set<Integer> instancesToRestart = Ranges.closedOpen(0, instanceCount).asSet(DiscreteDomains.integers()); RestartServiceInstancesStatus restartStatus = new RestartServiceInstancesStatus(serviceName, startTimeMs, endTimeMs, status, instancesToRestart); String toJson = GSON.toJson(restartStatus, RestartServiceInstancesStatus.class); table.put(Bytes.toBytes(serviceName + "-restart"), Bytes.toBytes(toJson)); }