public class TimerServiceImpl extends Object implements javax.ejb.TimerService, org.jboss.msc.service.Service<javax.ejb.TimerService>
TimerService| Modifier and Type | Field and Description |
|---|---|
static org.jboss.msc.service.ServiceName |
SERVICE_NAME |
| Constructor and Description |
|---|
TimerServiceImpl(Map<Method,List<AutoTimer>> autoTimers,
org.jboss.msc.service.ServiceName serviceName)
|
TimerServiceImpl(Map<Method,List<AutoTimer>> autoTimers,
org.jboss.msc.service.ServiceName serviceName,
TimerServiceRegistry registry)
Creates a
TimerServiceImpl |
| Modifier and Type | Method and Description |
|---|---|
void |
activate() |
protected void |
cancelTimeout(TimerImpl timer)
Cancels any scheduled
Future corresponding to the passed timer |
void |
cancelTimer(TimerImpl timer) |
javax.ejb.Timer |
createCalendarTimer(javax.ejb.ScheduleExpression schedule) |
javax.ejb.Timer |
createCalendarTimer(javax.ejb.ScheduleExpression schedule,
javax.ejb.TimerConfig timerConfig) |
javax.ejb.Timer |
createIntervalTimer(Date initialExpiration,
long intervalDuration,
javax.ejb.TimerConfig timerConfig) |
javax.ejb.Timer |
createIntervalTimer(long initialDuration,
long intervalDuration,
javax.ejb.TimerConfig timerConfig) |
javax.ejb.Timer |
createSingleActionTimer(Date expiration,
javax.ejb.TimerConfig timerConfig) |
javax.ejb.Timer |
createSingleActionTimer(long duration,
javax.ejb.TimerConfig timerConfig) |
javax.ejb.Timer |
createTimer(Date initialExpiration,
long intervalDuration,
Serializable info) |
javax.ejb.Timer |
createTimer(Date expiration,
Serializable info) |
javax.ejb.Timer |
createTimer(long initialDuration,
long intervalDuration,
Serializable info) |
javax.ejb.Timer |
createTimer(long duration,
Serializable info) |
void |
deactivate() |
void |
expireTimer(TimerImpl timer) |
Collection<javax.ejb.Timer> |
getAllTimers() |
org.jboss.msc.value.InjectedValue<EJBComponent> |
getEjbComponentInjectedValue() |
org.jboss.msc.value.InjectedValue<ExecutorService> |
getExecutorServiceInjectedValue() |
TimedObjectInvoker |
getInvoker()
Returns the
TimedObjectInvoker to which this timer service belongs |
TimerServiceResource |
getResource() |
org.jboss.msc.service.ServiceName |
getServiceName() |
org.jboss.msc.value.InjectedValue<TimedObjectInvoker> |
getTimedObjectInvoker() |
TimerImpl |
getTimer(String timerId) |
TimerImpl |
getTimer(javax.ejb.TimerHandle handle)
Returns the
Timer corresponding to the passed TimerHandle |
org.jboss.msc.value.InjectedValue<Timer> |
getTimerInjectedValue() |
org.jboss.msc.value.InjectedValue<TimerPersistence> |
getTimerPersistence() |
Collection<javax.ejb.Timer> |
getTimers() |
protected Transaction |
getTransaction() |
javax.ejb.TimerService |
getValue() |
protected boolean |
isLifecycleCallbackInvocation()
Returns true if the
CurrentInvocationContext represents a lifecycle
callback invocation. |
boolean |
isScheduled(String tid) |
boolean |
isStarted() |
TimerImpl |
loadAutoTimer(javax.ejb.ScheduleExpression schedule,
javax.ejb.TimerConfig timerConfig,
Method timeoutMethod) |
void |
persistTimer(TimerImpl timer,
boolean newTimer)
Persists the passed
timer. |
void |
restoreTimers(List<ScheduleTimer> autoTimers)
Restores persisted timers, corresponding to this timerservice, which are eligible for any new timeouts.
|
protected void |
scheduleTimeout(TimerImpl timer,
boolean newTimer)
Creates and schedules a
TimerTask for the next timeout of the passed timer |
boolean |
shouldRun(TimerImpl timer)
Check if a persistent timer is already executed from a different instance
or should be executed.
|
void |
start(org.jboss.msc.service.StartContext context) |
protected void |
startTimer(TimerImpl timer)
Registers a timer with a transaction (if any in progress) and then moves
the timer to an active state, so that it becomes eligible for timeouts
|
void |
stop(org.jboss.msc.service.StopContext context) |
void |
suspendTimers()
Suspends any currently scheduled tasks for
Timers |
@Deprecated public TimerServiceImpl(Map<Method,List<AutoTimer>> autoTimers, org.jboss.msc.service.ServiceName serviceName)
TimerServiceImpl(java.util.Map, org.jboss.msc.service.ServiceName, org.jboss.as.ejb3.component.TimerServiceRegistry) insteadTimerServiceImplautoTimers - serviceName - IllegalArgumentException - If either of the passed param is nullpublic TimerServiceImpl(Map<Method,List<AutoTimer>> autoTimers, org.jboss.msc.service.ServiceName serviceName, TimerServiceRegistry registry)
TimerServiceImplautoTimers - The auto timers associated with this timer serviceserviceName - The service name of this timer serviceregistry - The TimerServiceRegistry which has the knowledge of other timer services belonging to the EJB module to which this
timer service belongs.public void start(org.jboss.msc.service.StartContext context)
throws org.jboss.msc.service.StartException
start in interface org.jboss.msc.Serviceorg.jboss.msc.service.StartExceptionpublic void stop(org.jboss.msc.service.StopContext context)
stop in interface org.jboss.msc.Servicepublic void activate()
public void deactivate()
public javax.ejb.TimerService getValue()
throws IllegalStateException,
IllegalArgumentException
getValue in interface org.jboss.msc.value.Value<javax.ejb.TimerService>IllegalStateExceptionIllegalArgumentExceptionpublic javax.ejb.Timer createCalendarTimer(javax.ejb.ScheduleExpression schedule)
throws IllegalArgumentException,
IllegalStateException,
javax.ejb.EJBException
createCalendarTimer in interface javax.ejb.TimerServiceIllegalArgumentExceptionIllegalStateExceptionjavax.ejb.EJBExceptionpublic javax.ejb.Timer createCalendarTimer(javax.ejb.ScheduleExpression schedule,
javax.ejb.TimerConfig timerConfig)
throws IllegalArgumentException,
IllegalStateException,
javax.ejb.EJBException
createCalendarTimer in interface javax.ejb.TimerServiceIllegalArgumentExceptionIllegalStateExceptionjavax.ejb.EJBExceptionpublic javax.ejb.Timer createIntervalTimer(Date initialExpiration, long intervalDuration, javax.ejb.TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, javax.ejb.EJBException
createIntervalTimer in interface javax.ejb.TimerServiceIllegalArgumentExceptionIllegalStateExceptionjavax.ejb.EJBExceptionpublic javax.ejb.Timer createIntervalTimer(long initialDuration,
long intervalDuration,
javax.ejb.TimerConfig timerConfig)
throws IllegalArgumentException,
IllegalStateException,
javax.ejb.EJBException
createIntervalTimer in interface javax.ejb.TimerServiceIllegalArgumentExceptionIllegalStateExceptionjavax.ejb.EJBExceptionpublic javax.ejb.Timer createSingleActionTimer(Date expiration, javax.ejb.TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, javax.ejb.EJBException
createSingleActionTimer in interface javax.ejb.TimerServiceIllegalArgumentExceptionIllegalStateExceptionjavax.ejb.EJBExceptionpublic javax.ejb.Timer createSingleActionTimer(long duration,
javax.ejb.TimerConfig timerConfig)
throws IllegalArgumentException,
IllegalStateException,
javax.ejb.EJBException
createSingleActionTimer in interface javax.ejb.TimerServiceIllegalArgumentExceptionIllegalStateExceptionjavax.ejb.EJBExceptionpublic javax.ejb.Timer createTimer(long duration,
Serializable info)
throws IllegalArgumentException,
IllegalStateException,
javax.ejb.EJBException
createTimer in interface javax.ejb.TimerServiceIllegalArgumentExceptionIllegalStateExceptionjavax.ejb.EJBExceptionpublic javax.ejb.Timer createTimer(Date expiration, Serializable info) throws IllegalArgumentException, IllegalStateException, javax.ejb.EJBException
createTimer in interface javax.ejb.TimerServiceIllegalArgumentExceptionIllegalStateExceptionjavax.ejb.EJBExceptionpublic javax.ejb.Timer createTimer(long initialDuration,
long intervalDuration,
Serializable info)
throws IllegalArgumentException,
IllegalStateException,
javax.ejb.EJBException
createTimer in interface javax.ejb.TimerServiceIllegalArgumentExceptionIllegalStateExceptionjavax.ejb.EJBExceptionpublic javax.ejb.Timer createTimer(Date initialExpiration, long intervalDuration, Serializable info) throws IllegalArgumentException, IllegalStateException, javax.ejb.EJBException
createTimer in interface javax.ejb.TimerServiceIllegalArgumentExceptionIllegalStateExceptionjavax.ejb.EJBExceptionpublic TimerImpl loadAutoTimer(javax.ejb.ScheduleExpression schedule, javax.ejb.TimerConfig timerConfig, Method timeoutMethod)
public Collection<javax.ejb.Timer> getTimers() throws IllegalStateException, javax.ejb.EJBException
getTimers in interface javax.ejb.TimerServiceIllegalStateExceptionjavax.ejb.EJBExceptionpublic Collection<javax.ejb.Timer> getAllTimers() throws IllegalStateException, javax.ejb.EJBException
getAllTimers in interface javax.ejb.TimerServiceIllegalStateExceptionjavax.ejb.EJBExceptionpublic TimedObjectInvoker getInvoker()
TimedObjectInvoker to which this timer service belongspublic TimerImpl getTimer(javax.ejb.TimerHandle handle)
Timer corresponding to the passed TimerHandlehandle - The TimerHandle for which the Timer is being looked forprotected Transaction getTransaction()
javax.ejb.EJBException - If there is any system level exceptionpublic void persistTimer(TimerImpl timer, boolean newTimer)
timer.
If the passed timer is null or is non-persistent (i.e. Timer.isPersistent() returns false),
then this method acts as a no-op
timer - public void cancelTimer(TimerImpl timer) throws InterruptedException
InterruptedExceptionpublic void expireTimer(TimerImpl timer)
public void suspendTimers()
Timers
Note that, suspend does not cancel the Timer. Instead,
it just cancels the next scheduled timeout. So once the Timer
is restored (whenever that happens), the Timer will continue to
timeout at appropriate times.
public void restoreTimers(List<ScheduleTimer> autoTimers)
This includes timers whose TimerState is neither of the following:
All such restored timers will be schedule for their next timeouts.
autoTimers - protected void startTimer(TimerImpl timer)
protected boolean isLifecycleCallbackInvocation()
CurrentInvocationContext represents a lifecycle
callback invocation. Else returns false.
This method internally relies on CurrentInvocationContext.get() to obtain
the current invocation context.
TimerService methods
in the absence of CurrentInvocationContextprotected void scheduleTimeout(TimerImpl timer, boolean newTimer)
TimerTask for the next timeout of the passed timerprotected void cancelTimeout(TimerImpl timer)
Future corresponding to the passed timertimer - public boolean isScheduled(String tid)
public org.jboss.msc.value.InjectedValue<EJBComponent> getEjbComponentInjectedValue()
public org.jboss.msc.value.InjectedValue<ExecutorService> getExecutorServiceInjectedValue()
public org.jboss.msc.value.InjectedValue<Timer> getTimerInjectedValue()
public org.jboss.msc.value.InjectedValue<TimerPersistence> getTimerPersistence()
public org.jboss.msc.service.ServiceName getServiceName()
public boolean isStarted()
public org.jboss.msc.value.InjectedValue<TimedObjectInvoker> getTimedObjectInvoker()
public TimerServiceResource getResource()
public boolean shouldRun(TimerImpl timer)
true.timer - the timer which should be checkedtrue if the timer is not persistent or the persistent timer should startCopyright © 2019 JBoss by Red Hat. All rights reserved.