public class TimerImpl extends java.lang.Object implements Timer, java.io.Serializable
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cause the timer and all its associated expiration notifications to
be cancelled.
|
TimerHandle |
getHandle()
Get a serializable handle to the timer.
|
java.io.Serializable |
getInfo()
Get the information associated with the timer at the time of
creation.
|
java.util.Date |
getNextTimeout()
Get the point in time at which the next timer expiration is scheduled
to occur.
|
ScheduleExpression |
getSchedule()
Get the schedule expression corresponding to this timer.
|
long |
getTimeRemaining()
Get the number of milliseconds that will elapse before the next
scheduled timer expiration.
|
boolean |
isCalendarTimer()
Return whether this timer is a calendar-based timer.
|
boolean |
isPersistent()
Return whether this timer has persistent semantics.
|
public TimerImpl(TimerData timerData)
public void cancel() throws java.lang.IllegalStateException, NoSuchObjectLocalException
Timer
cancel
in interface Timer
java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.NoSuchObjectLocalException
- If invoked on a timer
that has expired or has been cancelled.public long getTimeRemaining() throws java.lang.IllegalStateException, NoSuchObjectLocalException
Timer
getTimeRemaining
in interface Timer
java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.NoSuchObjectLocalException
- If invoked on a timer
that has expired or has been cancelled.public java.util.Date getNextTimeout() throws java.lang.IllegalStateException, NoSuchObjectLocalException
Timer
getNextTimeout
in interface Timer
java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.NoSuchObjectLocalException
- If invoked on a timer
that has expired or has been cancelled.public java.io.Serializable getInfo() throws java.lang.IllegalStateException, NoSuchObjectLocalException
Timer
info
string that was
passed to the timer creation method or the info
element of the Schedule
annotaiton.getInfo
in interface Timer
java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.NoSuchObjectLocalException
- If invoked on a timer
that has expired or has been cancelled.public TimerHandle getHandle() throws java.lang.IllegalStateException, NoSuchObjectLocalException
Timer
getHandle
in interface Timer
java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method. Also thrown if invoked on a non-persistent timer.NoSuchObjectLocalException
- If invoked on a timer
that has expired or has been cancelled.public ScheduleExpression getSchedule() throws EJBException, java.lang.IllegalStateException, NoSuchObjectLocalException
Timer
getSchedule
in interface Timer
NoSuchObjectLocalException
- If invoked on a timer
that has expired or has been cancelled.EJBException
- If this method could not complete due
to a system-level failure.java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method. Also thrown if invoked on a timer that is not a
calendar-based timer.public boolean isPersistent() throws EJBException, java.lang.IllegalStateException, NoSuchObjectLocalException
Timer
isPersistent
in interface Timer
NoSuchObjectLocalException
- If invoked on a timer
that has expired or has been cancelled.EJBException
- If this method could not complete due
to a system-level failure.java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.public boolean isCalendarTimer() throws EJBException, java.lang.IllegalStateException, NoSuchObjectLocalException
Timer
isCalendarTimer
in interface Timer
NoSuchObjectLocalException
- If invoked on a timer
that has expired or has been cancelled.EJBException
- If this method could not complete due
to a system-level failure.java.lang.IllegalStateException
- If this method is
invoked while the instance is in a state that does not allow access
to this method.