Class JobExecutorService

java.lang.Object
org.noise_planet.noisemodelling.webserver.script.JobExecutorService

public class JobExecutorService extends Object
Manage pool of Job Threads.
  • Field Details

  • Constructor Details

    • JobExecutorService

      public JobExecutorService(int corePoolSize, int maximumPoolSize, long keepAliveTime, @NotNull TimeUnit unit)
  • Method Details

    • submitJob

      public <T> Future<T> submitJob(Job<T> job)
    • getJob

      public Job<?> getJob(int id)
      Parameters:
      id - Job identifier
      Returns:
      The job instance or null if it does not exist
    • cancelJob

      public boolean cancelJob(int jobId)
      Cancel a job
      Parameters:
      jobId - Job identifier
      Returns:
      true if the job was found and canceled, false otherwise
    • removeJob

      public Job<?> removeJob(int jobId)
      Remove a job from the service. This does not cancel the job if it is still running, it just removes it from the tracking map. See cancelJob(int jobId) to cancel a job before removing it.
      Parameters:
      jobId - Job identifier
      Returns:
      The removed job instance or null if it did not exist
    • shutdown

      public void shutdown()