use of io.datarouter.job.storage.stopjobrequest.StopJobRequestDao in project datarouter by hotpads.
the class JobStopperService method requestStop.
/**
* generates requests to stop a job running on the specified servers in the cluster. the requests are not processed
* until {@link JobStopperService#stopRequestedLocalJobs} is called (see {@link DatarouterJobStopperJob})
* @param jobName the name of the job (class) to stop
* @param serverNames the servers on which to attempt to stop the job
* @param username the username that requested the stop
*/
public void requestStop(String jobName, List<String> serverNames, String username) {
Instant jobTriggerDeadline = Instant.now();
Instant requestExpiration = jobTriggerDeadline.plus(3L, ChronoUnit.MINUTES);
Scanner.of(serverNames).map(serverName -> new StopJobRequest(serverName, requestExpiration, jobTriggerDeadline, jobName, username)).flush(stopJobRequestDao::putMulti);
}
Aggregations