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 |
---|---|
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 |
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 timedObjectId,
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() |
void |
invokeTimeout(TimerImpl timer) |
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 |
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 a 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
Timer s |
@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)
insteadTimerServiceImpl
autoTimers
- serviceName
- IllegalArgumentException
- If either of the passed param is nullpublic TimerServiceImpl(Map<Method,List<AutoTimer>> autoTimers, org.jboss.msc.service.ServiceName serviceName, TimerServiceRegistry registry)
TimerServiceImpl
autoTimers
- 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.service.Service<javax.ejb.TimerService>
org.jboss.msc.service.StartException
public void stop(org.jboss.msc.service.StopContext context)
stop
in interface org.jboss.msc.service.Service<javax.ejb.TimerService>
public javax.ejb.TimerService getValue() throws IllegalStateException, IllegalArgumentException
getValue
in interface org.jboss.msc.value.Value<javax.ejb.TimerService>
IllegalStateException
IllegalArgumentException
public javax.ejb.Timer createCalendarTimer(javax.ejb.ScheduleExpression schedule) throws IllegalArgumentException, IllegalStateException, javax.ejb.EJBException
createCalendarTimer
in interface javax.ejb.TimerService
IllegalArgumentException
IllegalStateException
javax.ejb.EJBException
public javax.ejb.Timer createCalendarTimer(javax.ejb.ScheduleExpression schedule, javax.ejb.TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, javax.ejb.EJBException
createCalendarTimer
in interface javax.ejb.TimerService
IllegalArgumentException
IllegalStateException
javax.ejb.EJBException
public javax.ejb.Timer createIntervalTimer(Date initialExpiration, long intervalDuration, javax.ejb.TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, javax.ejb.EJBException
createIntervalTimer
in interface javax.ejb.TimerService
IllegalArgumentException
IllegalStateException
javax.ejb.EJBException
public javax.ejb.Timer createIntervalTimer(long initialDuration, long intervalDuration, javax.ejb.TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, javax.ejb.EJBException
createIntervalTimer
in interface javax.ejb.TimerService
IllegalArgumentException
IllegalStateException
javax.ejb.EJBException
public javax.ejb.Timer createSingleActionTimer(Date expiration, javax.ejb.TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, javax.ejb.EJBException
createSingleActionTimer
in interface javax.ejb.TimerService
IllegalArgumentException
IllegalStateException
javax.ejb.EJBException
public javax.ejb.Timer createSingleActionTimer(long duration, javax.ejb.TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, javax.ejb.EJBException
createSingleActionTimer
in interface javax.ejb.TimerService
IllegalArgumentException
IllegalStateException
javax.ejb.EJBException
public javax.ejb.Timer createTimer(long duration, Serializable info) throws IllegalArgumentException, IllegalStateException, javax.ejb.EJBException
createTimer
in interface javax.ejb.TimerService
IllegalArgumentException
IllegalStateException
javax.ejb.EJBException
public javax.ejb.Timer createTimer(Date expiration, Serializable info) throws IllegalArgumentException, IllegalStateException, javax.ejb.EJBException
createTimer
in interface javax.ejb.TimerService
IllegalArgumentException
IllegalStateException
javax.ejb.EJBException
public javax.ejb.Timer createTimer(long initialDuration, long intervalDuration, Serializable info) throws IllegalArgumentException, IllegalStateException, javax.ejb.EJBException
createTimer
in interface javax.ejb.TimerService
IllegalArgumentException
IllegalStateException
javax.ejb.EJBException
public javax.ejb.Timer createTimer(Date initialExpiration, long intervalDuration, Serializable info) throws IllegalArgumentException, IllegalStateException, javax.ejb.EJBException
createTimer
in interface javax.ejb.TimerService
IllegalArgumentException
IllegalStateException
javax.ejb.EJBException
public 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.TimerService
IllegalStateException
javax.ejb.EJBException
public Collection<javax.ejb.Timer> getAllTimers() throws IllegalStateException, javax.ejb.EJBException
getAllTimers
in interface javax.ejb.TimerService
IllegalStateException
javax.ejb.EJBException
public TimedObjectInvoker getInvoker()
TimedObjectInvoker
to which this timer service belongspublic TimerImpl getTimer(javax.ejb.TimerHandle handle)
Timer
corresponding to the passed TimerHandle
handle
- 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)
public void expireTimer(TimerImpl timer)
public void suspendTimers()
Timer
s
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 CurrentInvocationContext
protected void scheduleTimeout(TimerImpl timer, boolean newTimer)
TimerTask
for the next timeout of the passed timer
protected void cancelTimeout(TimerImpl timer)
Future
corresponding to the passed timer
timer
- public void invokeTimeout(TimerImpl timer)
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()
Copyright © 2013 JBoss by Red Hat. All rights reserved.