Package com.levigo.jadice.server.core
Interface JobScheduler
-
- All Known Implementing Classes:
ThreadPoolJobScheduler
public interface JobSchedulerA JobScheduler is responsible for receiving and scheduling job execution requests.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidawaitFreeCapacity()Wait for free slots for the execution of jobs.voidexecute(ServerJob serverJob)Execute the given job.intgetActiveCount()Get the number of currently active (executing) jobs.StringgetInstanceName()TempFileReapergetTempFileReaper()Get a reaper for temporaryFilesWorkingDirectorygetWorkingDirectory()Get the working directory to be used for temporary files for this instance.booleanisRunning()Return whether the scheduler is running.voidnotifyStateChanged(ServerJob serverJob, Job.State state)voidsetInstanceName(String name)The scheduler's name (used for JMX naming purposes only)voidshutdown()Stop scheduling jobs.voidstart(RequestEndpoint<?> requestEndpoint)Start scheduling jobs listening on the given request endpoint.
-
-
-
Method Detail
-
shutdown
void shutdown()
Stop scheduling jobs. This method may not return immediately, but wait for any outstanding jobs to be finished first.
-
start
void start(RequestEndpoint<?> requestEndpoint) throws Exception
Start scheduling jobs listening on the given request endpoint.- Throws:
Exception- in case of startup failure
-
setInstanceName
void setInstanceName(String name)
The scheduler's name (used for JMX naming purposes only)- Parameters:
name- the name of thisJobSchedulerinstance
-
isRunning
boolean isRunning()
Return whether the scheduler is running.- Returns:
trueiff the scheduler is running
-
awaitFreeCapacity
void awaitFreeCapacity()
Wait for free slots for the execution of jobs.
-
execute
void execute(ServerJob serverJob)
Execute the given job.- Parameters:
serverJob- theServerJobto execute
-
getActiveCount
int getActiveCount()
Get the number of currently active (executing) jobs.- Returns:
- the number of executing jobss.
-
getInstanceName
String getInstanceName()
- Returns:
- the name of this server instance.
-
getWorkingDirectory
WorkingDirectory getWorkingDirectory()
Get the working directory to be used for temporary files for this instance.- Returns:
- the working directory that jobs should use
-
getTempFileReaper
TempFileReaper getTempFileReaper()
Get a reaper for temporaryFiles- Returns:
- a
TempFileReaper
-
notifyStateChanged
void notifyStateChanged(ServerJob serverJob, Job.State state)
Notifies informally the Job Scheduler that the viewer side'sJob.Stateof aServerJobhas changed. No mission critical component must rely on this information.- Parameters:
serverJob- The job that has changed the statestate- the new state
-
-