public class JDKTimerService extends Object implements TimerService, org.kie.api.time.SessionClock, InternalSchedulerService
Modifier and Type | Class and Description |
---|---|
static class |
JDKTimerService.JDKJobHandle |
Modifier and Type | Field and Description |
---|---|
protected TimerJobFactoryManager |
jobFactoryManager |
protected ScheduledThreadPoolExecutor |
scheduler |
Constructor and Description |
---|
JDKTimerService() |
JDKTimerService(int size) |
Modifier and Type | Method and Description |
---|---|
long |
getCurrentTime()
Returns the current time from the scheduler clock
|
TimerJobFactoryManager |
getTimerJobFactoryManager() |
Collection<TimerJobInstance> |
getTimerJobInstances(long id)
This method may return null for some TimerService implementations that do not want the overhead of maintain this.
|
long |
getTimeToNextJob()
Returns the number of time units (usually ms) to
the next scheduled job
|
void |
internalSchedule(TimerJobInstance timerJobInstance) |
boolean |
removeJob(JobHandle jobHandle)
Remove the job identified by the given job handle from the
scheduled queue
|
void |
reset()
Reset this service
|
JobHandle |
scheduleJob(Job job,
JobContext ctx,
Trigger trigger)
Schedule a job for later execution
|
void |
setTimerJobFactoryManager(TimerJobFactoryManager timerJobFactoryManager) |
void |
shutdown()
Shuts the service down
|
protected ScheduledThreadPoolExecutor scheduler
protected TimerJobFactoryManager jobFactoryManager
public JDKTimerService()
public JDKTimerService(int size)
public void setTimerJobFactoryManager(TimerJobFactoryManager timerJobFactoryManager)
setTimerJobFactoryManager
in interface TimerService
public TimerJobFactoryManager getTimerJobFactoryManager()
getTimerJobFactoryManager
in interface TimerService
public long getCurrentTime()
TimerService
getCurrentTime
in interface TimerService
getCurrentTime
in interface org.kie.api.time.SessionClock
public void reset()
TimerService
reset
in interface TimerService
public void shutdown()
TimerService
shutdown
in interface TimerService
public JobHandle scheduleJob(Job job, JobContext ctx, Trigger trigger)
SchedulerService
scheduleJob
in interface SchedulerService
public void internalSchedule(TimerJobInstance timerJobInstance)
internalSchedule
in interface InternalSchedulerService
public boolean removeJob(JobHandle jobHandle)
SchedulerService
removeJob
in interface SchedulerService
jobHandle
- the job identity handlepublic long getTimeToNextJob()
TimerService
getTimeToNextJob
in interface TimerService
public Collection<TimerJobInstance> getTimerJobInstances(long id)
TimerService
getTimerJobInstances
in interface TimerService
Copyright © 2001–2018 JBoss by Red Hat. All rights reserved.