se.l4.jobs.engine.JobControl Maven / Gradle / Ivy
The newest version!
package se.l4.jobs.engine;
import java.util.concurrent.CompletionStage;
/**
* Control given to instances of {@link JobsBackend} to allow them to control
* the job flow.
*/
public interface JobControl
{
/**
* Run the given job. This will queue up that the job should be run but
* will block until a thread to run the job becomes available. This is done
* so that the engine doesn't get overwhelmed with jobs which has a risk of
* causing an {@link OutOfMemoryError}.
*
* @param job
* @return
* a future that will complete when the job has finished running
*/
CompletionStage