Interface ServiceTimerProvider


  • public interface ServiceTimerProvider
    An interface for a provider that can be used by features to raise timers. The TimerEvents generated from the timers can be processed either directly, by a named feature, or by a feature execution script.

    If a feature raises a timer to be processed by a feature execution script, it should subsequently call 'featureHasFinished'. The timer, when firing, will cause a new feature execution point (and associated execution script) to be triggered, which can only happen properly if the feature raising the timer has given control back to the core via a 'featureHasFinished'.

    Care needs to be taken to make the expiry time of a timer large enough to allow any features running after the current feature in the execution script to complete successfully before the timer fires, otherwise the timer won't trigger the 'onTimer' feature execution script and the timer event will be dropped.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void cancelTimer​(javax.slee.facilities.TimerID timerId)
      Cancel the timer with the provided 'timerId', if it exists.
      void clearTimer​(javax.slee.facilities.TimerID timerId)
      Clear the timer with the provided 'timerId', if it exists.
      java.lang.String getFeatureNameForTimer​(javax.slee.facilities.TimerID timerID)
      Get the feature name that was provided when the timer was set.
      javax.slee.ActivityContextInterface getServiceTimerAci()  
      void registerTimer​(java.lang.String featureName, javax.slee.facilities.TimerID timerId, javax.slee.ActivityContextInterface aci)
      Register an already raised timer with the ServiceTimerProvider.
      void registerTimer​(javax.slee.facilities.TimerID timerId, javax.slee.ActivityContextInterface aci)
      Register an already raised timer with the ServiceTimerProvider.
      javax.slee.facilities.TimerID setPeriodicTimer​(long startTime, long period, int numRepetitions)
      Raise a new periodic service feature timer.
      javax.slee.facilities.TimerID setPeriodicTimer​(long startTime, long period, int numRepetitions, javax.slee.facilities.TimerOptions options)
      Raise a new periodic service feature timer.
      javax.slee.facilities.TimerID setPeriodicTimer​(java.lang.String featureName, long startTime, long period, int numRepetitions)
      Raise a new periodic service feature timer.
      javax.slee.facilities.TimerID setPeriodicTimer​(java.lang.String featureName, long startTime, long period, int numRepetitions, javax.slee.facilities.TimerOptions options)
      Raise a new periodic service feature timer.
      javax.slee.facilities.TimerID setTimer​(long expiryTime)
      Raise a new service feature timer.
      javax.slee.facilities.TimerID setTimer​(long expiryTime, javax.slee.facilities.TimerOptions options)
      Raise a new service feature timer.
      javax.slee.facilities.TimerID setTimer​(java.lang.String featureName, long expiryTime)
      Raise a new service feature timer.
      javax.slee.facilities.TimerID setTimer​(java.lang.String featureName, long expiryTime, javax.slee.facilities.TimerOptions options)
      Raise a new service feature timer.
      boolean timerIsSet​(javax.slee.facilities.TimerID timerId)
      Check if a timer with the provided timerID is currently set and registered with the provider.
    • Method Detail

      • setTimer

        javax.slee.facilities.TimerID setTimer​(long expiryTime)
        Raise a new service feature timer. When timer fires, the TimerEvent will be delivered via the dedicated 'onTimer' feature execution point. Using default TimerOptions.
        Parameters:
        expiryTime - The timestamp when the timer is supposed to expire.
        Returns:
        The TimerID for the timer.
      • setTimer

        javax.slee.facilities.TimerID setTimer​(long expiryTime,
                                               javax.slee.facilities.TimerOptions options)
        Raise a new service feature timer. When timer fires, the TimerEvent will be delivered via the dedicated 'onTimer' feature execution point.
        Parameters:
        expiryTime - The timestamp when the timer is supposed to expire.
        options - The SLEE TimerOptions that shall be used to raise the timer.
        Returns:
        The TimerID for the timer.
      • setTimer

        javax.slee.facilities.TimerID setTimer​(java.lang.String featureName,
                                               long expiryTime)
        Raise a new service feature timer. When timer fires, the TimerEvent will be delivered as an extension event to the named feature. Using default TimerOptions.
        Parameters:
        featureName - The name of the feature to deliver TimerEvents to.
        expiryTime - The timestamp when the timer is supposed to expire.
        Returns:
        The TimerID for the timer.
      • setTimer

        javax.slee.facilities.TimerID setTimer​(java.lang.String featureName,
                                               long expiryTime,
                                               javax.slee.facilities.TimerOptions options)
        Raise a new service feature timer. When timer fires, the TimerEvent will be delivered as an extension event to the named feature.
        Parameters:
        featureName - The name of the feature to deliver TimerEvents to.
        expiryTime - The timestamp when the timer is supposed to expire.
        options - The SLEE TimerOptions that shall be used to raise the timer.
        Returns:
        The TimerID for the timer.
      • setPeriodicTimer

        javax.slee.facilities.TimerID setPeriodicTimer​(long startTime,
                                                       long period,
                                                       int numRepetitions)
        Raise a new periodic service feature timer. Each time the timer fires, a TimerEvent will be delivered via the dedicated 'onTimer' feature execution point. The timer will repeatedly fire with the given period for the given number of repetitions. Using default TimerOptions.
        Parameters:
        startTime - The timestamp when the timer should fire for the first time.
        period - The amount of time to wait between each firing of the timer.
        numRepetitions - The maximum number of times that the timer should fire (0 for no limit)
        Returns:
        The TimerID for the timer.
      • setPeriodicTimer

        javax.slee.facilities.TimerID setPeriodicTimer​(long startTime,
                                                       long period,
                                                       int numRepetitions,
                                                       javax.slee.facilities.TimerOptions options)
        Raise a new periodic service feature timer. Each time the timer fires, a TimerEvent will be delivered via the dedicated 'onTimer' feature execution point. The timer will repeatedly fire with the given period for the given number of repetitions.
        Parameters:
        startTime - The timestamp when the timer should fire for the first time.
        period - The amount of time to wait between each firing of the timer.
        numRepetitions - The maximum number of times that the timer should fire (0 for no limit)
        options - The SLEE TimerOptions that shall be used to raise the timer.
        Returns:
        The TimerID for the timer.
      • setPeriodicTimer

        javax.slee.facilities.TimerID setPeriodicTimer​(java.lang.String featureName,
                                                       long startTime,
                                                       long period,
                                                       int numRepetitions)
        Raise a new periodic service feature timer. Each time the timer fires, a TimerEvent will be delivered as an extension event to the named feature. The timer will repeatedly fire with the given period for the given number of repetitions. Using default TimerOptions.
        Parameters:
        featureName - The name of the feature to deliver TimerEvents to.
        startTime - The timestamp when the timer should fire for the first time.
        period - The amount of time to wait between each firing of the timer.
        numRepetitions - The maximum number of times that the timer should fire (0 for no limit)
        Returns:
        The TimerID for the timer.
      • setPeriodicTimer

        javax.slee.facilities.TimerID setPeriodicTimer​(java.lang.String featureName,
                                                       long startTime,
                                                       long period,
                                                       int numRepetitions,
                                                       javax.slee.facilities.TimerOptions options)
        Raise a new periodic service feature timer. Each time the timer fires, a TimerEvent will be delivered as an extension event to the named feature. The timer will repeatedly fire with the given period for the given number of repetitions.
        Parameters:
        featureName - The name of the feature to deliver TimerEvents to.
        startTime - The timestamp when the timer should fire for the first time.
        period - The amount of time to wait between each firing of the timer.
        numRepetitions - The maximum number of times that the timer should fire (0 for no limit)
        options - The SLEE TimerOptions that shall be used to raise the timer.
        Returns:
        The TimerID for the timer.
      • registerTimer

        void registerTimer​(javax.slee.facilities.TimerID timerId,
                           javax.slee.ActivityContextInterface aci)
                    throws ServiceTimerAlreadyExistsException
        Register an already raised timer with the ServiceTimerProvider. Also attaches the service Sbb to the provided timer ACI, so the TimerEvent can actually be received when it occurs.
        Parameters:
        timerId - The SLEE timer id of the raised timer.
        aci - The ActivityContextInterface the timer was raised on and to which the service's main Sbb shall be attached.
        Throws:
        ServiceTimerAlreadyExistsException - If this timer has already been registered.
      • registerTimer

        void registerTimer​(java.lang.String featureName,
                           javax.slee.facilities.TimerID timerId,
                           javax.slee.ActivityContextInterface aci)
                    throws ServiceTimerAlreadyExistsException
        Register an already raised timer with the ServiceTimerProvider. Also attaches the service Sbb to the provided timer ACI, so the TimerEvent can actually be received when it occurs.
        Parameters:
        featureName - The name of the feature to deliver TimerEvents to.
        timerId - The SLEE timer id of the raised timer.
        aci - The ActivityContextInterface the timer was raised on and to which the service's main Sbb shall be attached.
        Throws:
        ServiceTimerAlreadyExistsException - If this timer has already been registered.
      • cancelTimer

        void cancelTimer​(javax.slee.facilities.TimerID timerId)
        Cancel the timer with the provided 'timerId', if it exists. If there is no timer with the given 'timerId' registered, the operation has no effect.
        Parameters:
        timerId - The id of the timer to be cancelled and de-registered.
      • clearTimer

        void clearTimer​(javax.slee.facilities.TimerID timerId)
        Clear the timer with the provided 'timerId', if it exists. If there is no timer with the given 'timerId' registered, the operation has no effect. Used on receipt of a TimerEvent with this timerId.
        Parameters:
        timerId - The id of the timer to be cancelled and de-registered.
      • timerIsSet

        boolean timerIsSet​(javax.slee.facilities.TimerID timerId)
        Check if a timer with the provided timerID is currently set and registered with the provider.
        Parameters:
        timerId - The SLEE Timer ID of the timer to check.
        Returns:
        true if the timer was set and registered with the provider; false otherwise.
      • getFeatureNameForTimer

        java.lang.String getFeatureNameForTimer​(javax.slee.facilities.TimerID timerID)
        Get the feature name that was provided when the timer was set.
        Parameters:
        timerID - the timer
        Returns:
        the feature name used when the timer was created, or null if no feature name was provided.
      • getServiceTimerAci

        javax.slee.ActivityContextInterface getServiceTimerAci()
        Returns:
        the service timer aci used by the service timer provider. May be null if not set.