public class TimerServiceImpl extends java.lang.Object implements TimerService
Constructor and Description |
---|
TimerServiceImpl(EjbTimerService ejbTimerService,
java.lang.Object primaryKey,
java.lang.reflect.Method ejbTimeout) |
Modifier and Type | Method and Description |
---|---|
Timer |
createCalendarTimer(ScheduleExpression scheduleExpression)
Create a calendar-based timer based on the input schedule expression.
|
Timer |
createCalendarTimer(ScheduleExpression scheduleExpression,
TimerConfig timerConfig)
Create a calendar-based timer based on the input schedule expression.
|
Timer |
createIntervalTimer(java.util.Date initialExpiration,
long lintervalDuration,
TimerConfig timerConfig)
Create an interval timer whose first expiration occurs at a given
point in time and whose subsequent expirations occur after a specified
interval.
|
Timer |
createIntervalTimer(long initialDuration,
long intervalDuration,
TimerConfig timerConfig)
Create an interval timer whose first expiration occurs after a specified
duration, and whose subsequent expirations occur after a specified
interval.
|
Timer |
createSingleActionTimer(java.util.Date expiration,
TimerConfig timerConfig)
Create a single-action timer that expires at a given point in time.
|
Timer |
createSingleActionTimer(long duration,
TimerConfig timerConfig)
Create a single-action timer that expires after a specified duration.
|
Timer |
createTimer(java.util.Date initialExpiration,
long intervalDuration,
java.io.Serializable info)
Create an interval timer whose first expiration occurs at a given
point in time and whose subsequent expirations occur after a specified
interval.
|
Timer |
createTimer(java.util.Date expiration,
java.io.Serializable info)
Create a single-action timer that expires at a given point in time.
|
Timer |
createTimer(long initialDuration,
long intervalDuration,
java.io.Serializable info)
Create an interval timer whose first expiration occurs after a specified
duration, and whose subsequent expirations occur after a specified
interval.
|
Timer |
createTimer(long duration,
java.io.Serializable info)
Create a single-action timer that expires after a specified duration.
|
java.util.Collection<Timer> |
getAllTimers()
Returns all active timers associated with the beans in the same module in
which the caller bean is packaged.
|
java.util.Collection<Timer> |
getTimers()
Returns all active timers associated with this bean.
|
public TimerServiceImpl(EjbTimerService ejbTimerService, java.lang.Object primaryKey, java.lang.reflect.Method ejbTimeout)
public Timer createTimer(java.util.Date initialExpiration, long intervalDuration, java.io.Serializable info) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, EJBException
TimerService
createTimer
in interface TimerService
initialExpiration
- the point in time at which the first timer
expiration must occur.intervalDuration
- the number of milliseconds that must elapse
between timer expiration notifications. Expiration notifications are
scheduled relative to the time of the first expiration. If expiration
is delayed (e.g. due to the interleaving of other method calls on the
bean), two or more expiration notifications may occur in close
succession to "catch up".info
- application information to be delivered along
with the timer expiration. This can be null.java.lang.IllegalArgumentException
- If
initialExpiration is null, if initialExpiration.getTime() is
negative, or if intervalDuration is negative.java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.EJBException
- If this method could not complete
due to a system-level failure.public Timer createTimer(java.util.Date expiration, java.io.Serializable info) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, EJBException
TimerService
createTimer
in interface TimerService
expiration
- The point in time at which the timer must expire.info
- application information to be delivered along
with the timer expiration notification. This can be null.java.lang.IllegalArgumentException
- If expiration is null or
expiration.getTime() is negative.java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.EJBException
- If this method could not complete
due to a system-level failure.public Timer createTimer(long initialDuration, long intervalDuration, java.io.Serializable info) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, EJBException
TimerService
createTimer
in interface TimerService
initialDuration
- The number of milliseconds that must elapse
before the first timer expiration notification.intervalDuration
- The number of milliseconds that must elapse
between timer expiration notifications. Expiration notifications are
scheduled relative to the time of the first expiration. If expiration
is delayed (e.g. due to the interleaving of other method calls on the
bean), two or more expiration notifications may occur in close
succession to "catch up".info
- application information to be delivered along
with the timer expiration. This can be null.java.lang.IllegalArgumentException
- If initialDuration is
negative or intervalDuration is negative.java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.EJBException
- If this method could not complete
due to a system-level failure.public Timer createTimer(long duration, java.io.Serializable info) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, EJBException
TimerService
createTimer
in interface TimerService
duration
- the number of milliseconds that must elapse before
the timer expires.info
- application information to be delivered along
with the timer expiration notification. This can be null.java.lang.IllegalArgumentException
- If duration is negativejava.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.EJBException
- If this method fails due to a
system-level failure.public java.util.Collection<Timer> getTimers() throws java.lang.IllegalStateException, EJBException
TimerService
getTimers
in interface TimerService
javax.ejb.Timer
objects.java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.EJBException
- If this method could not complete
due to a system-level failure.public Timer createSingleActionTimer(long duration, TimerConfig timerConfig) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, EJBException
TimerService
createSingleActionTimer
in interface TimerService
duration
- the number of milliseconds that must elapse before
the timer expires.timerConfig
- timer configuration.java.lang.IllegalArgumentException
- If duration is negativejava.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.EJBException
- If this method fails due to a
system-level failure.public Timer createSingleActionTimer(java.util.Date expiration, TimerConfig timerConfig) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, EJBException
TimerService
createSingleActionTimer
in interface TimerService
expiration
- the point in time at which the timer must expire.timerConfig
- timer configuration.java.lang.IllegalArgumentException
- If expiration is null or
expiration.getTime() is negative.java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.EJBException
- If this method could not complete
due to a system-level failure.public Timer createIntervalTimer(long initialDuration, long intervalDuration, TimerConfig timerConfig) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, EJBException
TimerService
createIntervalTimer
in interface TimerService
initialDuration
- The number of milliseconds that must elapse
before the first timer expiration notification.intervalDuration
- The number of milliseconds that must elapse
between timer expiration notifications. Expiration notifications are
scheduled relative to the time of the first expiration. If expiration
is delayed (e.g. due to the interleaving of other method calls on the
bean), two or more expiration notifications may occur in close
succession to "catch up".timerConfig
- timer configurationjava.lang.IllegalArgumentException
- If initialDuration is
negative or intervalDuration is negative.java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.EJBException
- If this method could not complete
due to a system-level failure.public Timer createIntervalTimer(java.util.Date initialExpiration, long lintervalDuration, TimerConfig timerConfig) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, EJBException
TimerService
createIntervalTimer
in interface TimerService
initialExpiration
- the point in time at which the first timer
expiration must occur.lintervalDuration
- the number of milliseconds that must elapse
between timer expiration notifications. Expiration notifications are
scheduled relative to the time of the first expiration. If expiration
is delayed (e.g. due to the interleaving of other method calls on the
bean), two or more expiration notifications may occur in close
succession to "catch up".timerConfig
- timer configuration.java.lang.IllegalArgumentException
- If
initialExpiration is null, if initialExpiration.getTime() is
negative, or if intervalDuration is negative.java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.EJBException
- If this method could not complete
due to a system-level failure.public Timer createCalendarTimer(ScheduleExpression scheduleExpression) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, EJBException
TimerService
createCalendarTimer
in interface TimerService
scheduleExpression
- a schedule expression describing the timeouts
for this timer.java.lang.IllegalArgumentException
- If Schedule represents an
invalid schedule expression.java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.EJBException
- If this method could not complete
due to a system-level failure.public Timer createCalendarTimer(ScheduleExpression scheduleExpression, TimerConfig timerConfig) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, EJBException
TimerService
createCalendarTimer
in interface TimerService
scheduleExpression
- a schedule expression describing the timeouts for this timer.timerConfig
- timer configuration.java.lang.IllegalArgumentException
- If Schedule represents an
invalid schedule expression.java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.EJBException
- If this method could not complete
due to a system-level failure.public java.util.Collection<Timer> getAllTimers() throws java.lang.IllegalStateException, EJBException
TimerService
getAllTimers
in interface TimerService
javax.ejb.Timer
objects.java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.EJBException
- If this method could not complete
due to a system-level failure.