javax.ejb

Interface TimerService


  • public interface TimerService
    The TimerService interface provides enterprise bean components with access to the container-provided Timer Service. The EJB Timer Service allows stateless session beans, singleton session beans, message-driven beans, and EJB 2.x entity beans to be registered for timer callback events at a specified time, after a specified elapsed time, after a specified interval, or according to a calendar-based schedule.
    Since:
    EJB 2.1
    • Method Detail

      • createTimer

        Timer createTimer(long duration,
                          Serializable info)
                   throws IllegalArgumentException,
                          IllegalStateException,
                          EJBException
        Create a single-action timer that expires after a specified duration.
        Parameters:
        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.
        Returns:
        the newly created Timer.
        Throws:
        IllegalArgumentException - If duration is negative
        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.
      • createSingleActionTimer

        Timer createSingleActionTimer(long duration,
                                      TimerConfig timerConfig)
                               throws IllegalArgumentException,
                                      IllegalStateException,
                                      EJBException
        Create a single-action timer that expires after a specified duration.
        Parameters:
        duration - the number of milliseconds that must elapse before the timer expires.
        timerConfig - timer configuration.
        Returns:
        the newly created Timer.
        Throws:
        IllegalArgumentException - If duration is negative
        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.
        Since:
        EJB 3.1
      • createTimer

        Timer createTimer(long initialDuration,
                          long intervalDuration,
                          Serializable info)
                   throws IllegalArgumentException,
                          IllegalStateException,
                          EJBException
        Create an interval timer whose first expiration occurs after a specified duration, and whose subsequent expirations occur after a specified interval.
        Parameters:
        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.
        Returns:
        the newly created Timer.
        Throws:
        IllegalArgumentException - If initialDuration is negative or intervalDuration is negative.
        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.
      • createIntervalTimer

        Timer createIntervalTimer(long initialDuration,
                                  long intervalDuration,
                                  TimerConfig timerConfig)
                           throws IllegalArgumentException,
                                  IllegalStateException,
                                  EJBException
        Create an interval timer whose first expiration occurs after a specified duration, and whose subsequent expirations occur after a specified interval.
        Parameters:
        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 configuration
        Returns:
        the newly created Timer.
        Throws:
        IllegalArgumentException - If initialDuration is negative or intervalDuration is negative.
        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.
        Since:
        EJB 3.1
      • createTimer

        Timer createTimer(Date expiration,
                          Serializable info)
                   throws IllegalArgumentException,
                          IllegalStateException,
                          EJBException
        Create a single-action timer that expires at a given point in time.
        Parameters:
        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.
        Returns:
        the newly created Timer.
        Throws:
        IllegalArgumentException - If expiration is null or expiration.getTime() is negative.
        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.
      • createSingleActionTimer

        Timer createSingleActionTimer(Date expiration,
                                      TimerConfig timerConfig)
                               throws IllegalArgumentException,
                                      IllegalStateException,
                                      EJBException
        Create a single-action timer that expires at a given point in time.
        Parameters:
        expiration - the point in time at which the timer must expire.
        timerConfig - timer configuration.
        Returns:
        the newly created Timer.
        Throws:
        IllegalArgumentException - If expiration is null or expiration.getTime() is negative.
        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.
        Since:
        EJB 3.1
      • createTimer

        Timer createTimer(Date initialExpiration,
                          long intervalDuration,
                          Serializable info)
                   throws IllegalArgumentException,
                          IllegalStateException,
                          EJBException
        Create an interval timer whose first expiration occurs at a given point in time and whose subsequent expirations occur after a specified interval.
        Parameters:
        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.
        Returns:
        the newly created Timer.
        Throws:
        IllegalArgumentException - If initialExpiration is null, if initialExpiration.getTime() is negative, or if intervalDuration is negative.
        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.
      • createIntervalTimer

        Timer createIntervalTimer(Date initialExpiration,
                                  long intervalDuration,
                                  TimerConfig timerConfig)
                           throws IllegalArgumentException,
                                  IllegalStateException,
                                  EJBException
        Create an interval timer whose first expiration occurs at a given point in time and whose subsequent expirations occur after a specified interval.
        Parameters:
        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".
        timerConfig - timer configuration.
        Returns:
        the newly created Timer.
        Throws:
        IllegalArgumentException - If initialExpiration is null, if initialExpiration.getTime() is negative, or if intervalDuration is negative.
        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.
        Since:
        EJB 3.1
      • getTimers

        Collection<Timer> getTimers()
                             throws IllegalStateException,
                                    EJBException
        Returns all active timers associated with this bean. These include both the programmatically-created timers and the automatically-created timers.
        Returns:
        a collection of javax.ejb.Timer objects.
        Throws:
        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.
      • getAllTimers

        Collection<Timer> getAllTimers()
                                throws IllegalStateException,
                                       EJBException
        Returns all active timers associated with the beans in the same module in which the caller bean is packaged. These include both the programmatically-created timers and the automatically-created timers.
        Returns:
        a collection of javax.ejb.Timer objects.
        Throws:
        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.
        Since:
        EJB 3.2

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/TimerService.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

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com, TimerService (Java(TM) EE 7 Specification APIs)

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.