Package jakarta.ejb
Interface Timer
-
public interface TimerTheTimerinterface contains information about a timer that was created through the enterprise bean Timer Service.- Since:
- EJB 2.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcancel()Cause the timer and all its associated expiration notifications to be cancelled.TimerHandlegetHandle()Get a serializable handle to the timer.SerializablegetInfo()Get the information associated with the timer at the time of creation.DategetNextTimeout()Get the point in time at which the next timer expiration is scheduled to occur.ScheduleExpressiongetSchedule()Get the schedule expression corresponding to this timer.longgetTimeRemaining()Get the number of milliseconds that will elapse before the next scheduled timer expiration.booleanisCalendarTimer()Return whether this timer is a calendar-based timer.booleanisPersistent()Return whether this timer has persistent semantics.
-
-
-
Method Detail
-
cancel
void cancel() throws IllegalStateException, NoSuchObjectLocalException, EJBExceptionCause the timer and all its associated expiration notifications to be cancelled.- Throws:
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.EJBException- If this method could not complete due to a system-level failure.
-
getTimeRemaining
long getTimeRemaining() throws IllegalStateException, NoSuchObjectLocalException, NoMoreTimeoutsException, EJBExceptionGet the number of milliseconds that will elapse before the next scheduled timer expiration.- Returns:
- the number of milliseconds that will elapse before the next scheduled timer expiration.
- Throws:
IllegalStateException- If this method is invoked while the instance is in a state that does not allow access to this method.NoMoreTimeoutsException- Indicates that the timer has no future timeoutsNoSuchObjectLocalException- 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.
-
getNextTimeout
Date getNextTimeout() throws IllegalStateException, NoSuchObjectLocalException, NoMoreTimeoutsException, EJBException
Get the point in time at which the next timer expiration is scheduled to occur.- Returns:
- the point in time at which the next timer expiration is scheduled to occur.
- Throws:
IllegalStateException- If this method is invoked while the instance is in a state that does not allow access to this method.NoMoreTimeoutsException- Indicates that the timer has no future timeoutsNoSuchObjectLocalException- 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.
-
getSchedule
ScheduleExpression getSchedule() throws IllegalStateException, NoSuchObjectLocalException, EJBException
Get the schedule expression corresponding to this timer. The timer must be a calendar-based timer. It may have been created automatically or programmatically.- Returns:
- schedule expression for the timer.
- Throws:
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.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.- Since:
- EJB 3.1
-
isPersistent
boolean isPersistent() throws IllegalStateException, NoSuchObjectLocalException, EJBExceptionReturn whether this timer has persistent semantics.- Returns:
- boolean indicating whether the timer is persistent.
- Throws:
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.EJBException- If this method could not complete due to a system-level failure.- Since:
- EJB 3.1
-
isCalendarTimer
boolean isCalendarTimer() throws IllegalStateException, NoSuchObjectLocalException, EJBExceptionReturn whether this timer is a calendar-based timer.- Returns:
- boolean indicating whether the timer is calendar-based.
- Throws:
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.EJBException- If this method could not complete due to a system-level failure.- Since:
- EJB 3.1
-
getInfo
Serializable getInfo() throws IllegalStateException, NoSuchObjectLocalException, EJBException
Get the information associated with the timer at the time of creation. This may be theinfostring that was passed to the timer creation method or theinfoelement of theScheduleannotaiton.- Returns:
- The Serializable object that was passed in at timer creation, or null if the info argument passed in at timer creation was null.
- Throws:
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.EJBException- If this method could not complete due to a system-level failure.
-
getHandle
TimerHandle getHandle() throws IllegalStateException, NoSuchObjectLocalException, EJBException
Get a serializable handle to the timer. This handle can be used at a later time to re-obtain the timer reference.- Returns:
- a serializable handle to the timer.
- Throws:
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.EJBException- If this method could not complete due to a system-level failure.
-
-