Class JobExecutorService
java.lang.Object
org.noise_planet.noisemodelling.webserver.script.JobExecutorService
Manage pool of Job Threads.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJobExecutorService(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit) -
Method Summary
-
Field Details
-
jobs
-
executorService
-
-
Constructor Details
-
JobExecutorService
public JobExecutorService(int corePoolSize, int maximumPoolSize, long keepAliveTime, @NotNull TimeUnit unit)
-
-
Method Details
-
submitJob
-
getJob
- 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
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()
-