-
public interface Timer
TheTimer
interface contains information about a timer that was created through the EJB Timer Service.- Since:
- EJB 2.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods 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.Serializable
getInfo()
Get the information associated with the timer at the time of creation.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.
-
-
-
Method Detail
-
cancel
void cancel() throws IllegalStateException, NoSuchObjectLocalException, EJBException
Cause 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, EJBException
Get 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.NoSuchObjectLocalException
- If invoked on a timer that has expired or has been cancelled.javax.ejb.NoMoreTimeoutsExceptions
- Indicates that the timer has no future timeoutsEJBException
- If this method could not complete due to a system-level failure.NoMoreTimeoutsException
-
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.NoSuchObjectLocalException
- If invoked on a timer that has expired or has been cancelled.javax.ejb.NoMoreTimeoutsExceptions
- Indicates that the timer has no future timeoutsEJBException
- If this method could not complete due to a system-level failure.NoMoreTimeoutsException
-
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, EJBException
Return 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, EJBException
Return 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 theinfo
string that was passed to the timer creation method or theinfo
element of theSchedule
annotaiton.- 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.
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 18/08/2025 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-javaee-rf-javax/ejb/Timer.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.