Package com.levigo.jadice.server.core
Interface JobScheduler
-
- All Known Implementing Classes:
ThreadPoolJobScheduler
public interface JobScheduler
A JobScheduler is responsible for receiving and scheduling job execution requests.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
awaitFreeCapacity()
Wait for free slots for the execution of jobs.void
execute(ServerJob serverJob)
Execute the given job.int
getActiveCount()
Get the number of currently active (executing) jobs.String
getInstanceName()
TempFileReaper
getTempFileReaper()
Get a reaper for temporaryFile
sWorkingDirectory
getWorkingDirectory()
Get the working directory to be used for temporary files for this instance.boolean
isRunning()
Return whether the scheduler is running.void
notifyStateChanged(ServerJob serverJob, Job.State state)
void
setInstanceName(String name)
The scheduler's name (used for JMX naming purposes only)void
shutdown()
Stop scheduling jobs.void
start(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 thisJobScheduler
instance
-
isRunning
boolean isRunning()
Return whether the scheduler is running.- Returns:
true
iff 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
- theServerJob
to 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 temporaryFile
s- Returns:
- a
TempFileReaper
-
notifyStateChanged
void notifyStateChanged(ServerJob serverJob, Job.State state)
Notifies informally the Job Scheduler that the viewer side'sJob.State
of aServerJob
has changed. No mission critical component must rely on this information.- Parameters:
serverJob
- The job that has changed the statestate
- the new state
-
-