org.springframework.scheduling.commonj

Class ScheduledTimerListener

  • java.lang.Object
    • org.springframework.scheduling.commonj.ScheduledTimerListener

  • Deprecated. 
    as of 5.1, in favor of EE 7's DefaultManagedTaskScheduler

    @Deprecated
    public class ScheduledTimerListener
    extends java.lang.Object
    JavaBean that describes a scheduled TimerListener, consisting of the TimerListener itself (or a Runnable to create a TimerListener for) and a delay plus period. Period needs to be specified; there is no point in a default for it.

    The CommonJ TimerManager does not offer more sophisticated scheduling options such as cron expressions. Consider using Quartz for such advanced needs.

    Note that the TimerManager uses a TimerListener instance that is shared between repeated executions, in contrast to Quartz which instantiates a new Job for each execution.

    Since:
    2.0
    Author:
    Juergen Hoeller
    • Constructor Summary

      Constructors 
      Constructor and Description
      ScheduledTimerListener()
      Deprecated. 
      Create a new ScheduledTimerListener, to be populated via bean properties.
      ScheduledTimerListener(java.lang.Runnable timerTask)
      Deprecated. 
      Create a new ScheduledTimerListener, with default one-time execution without delay.
      ScheduledTimerListener(java.lang.Runnable timerTask, long delay)
      Deprecated. 
      Create a new ScheduledTimerListener, with default one-time execution with the given delay.
      ScheduledTimerListener(java.lang.Runnable timerTask, long delay, long period, boolean fixedRate)
      Deprecated. 
      Create a new ScheduledTimerListener.
      ScheduledTimerListener(commonj.timers.TimerListener timerListener)
      Deprecated. 
      Create a new ScheduledTimerListener, with default one-time execution without delay.
      ScheduledTimerListener(commonj.timers.TimerListener timerListener, long delay)
      Deprecated. 
      Create a new ScheduledTimerListener, with default one-time execution with the given delay.
      ScheduledTimerListener(commonj.timers.TimerListener timerListener, long delay, long period, boolean fixedRate)
      Deprecated. 
      Create a new ScheduledTimerListener.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method and Description
      long getDelay()
      Deprecated. 
      Return the delay before starting the job for the first time.
      long getPeriod()
      Deprecated. 
      Return the period between repeated task executions.
      commonj.timers.TimerListener getTimerListener()
      Deprecated. 
      Return the TimerListener to schedule.
      boolean isFixedRate()
      Deprecated. 
      Return whether to schedule as fixed-rate execution.
      boolean isOneTimeTask()
      Deprecated. 
      Is this task only ever going to execute once?
      void setDelay(long delay)
      Deprecated. 
      Set the delay before starting the task for the first time, in milliseconds.
      void setFixedRate(boolean fixedRate)
      Deprecated. 
      Set whether to schedule as fixed-rate execution, rather than fixed-delay execution.
      void setPeriod(long period)
      Deprecated. 
      Set the period between repeated task executions, in milliseconds.
      void setRunnable(java.lang.Runnable timerTask)
      Deprecated. 
      Set the Runnable to schedule as TimerListener.
      void setTimerListener(commonj.timers.TimerListener timerListener)
      Deprecated. 
      Set the TimerListener to schedule.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScheduledTimerListener

        public ScheduledTimerListener(commonj.timers.TimerListener timerListener)
        Deprecated. 
        Create a new ScheduledTimerListener, with default one-time execution without delay.
        Parameters:
        timerListener - the TimerListener to schedule
      • ScheduledTimerListener

        public ScheduledTimerListener(commonj.timers.TimerListener timerListener,
                                      long delay)
        Deprecated. 
        Create a new ScheduledTimerListener, with default one-time execution with the given delay.
        Parameters:
        timerListener - the TimerListener to schedule
        delay - the delay before starting the task for the first time (ms)
      • ScheduledTimerListener

        public ScheduledTimerListener(commonj.timers.TimerListener timerListener,
                                      long delay,
                                      long period,
                                      boolean fixedRate)
        Deprecated. 
        Create a new ScheduledTimerListener.
        Parameters:
        timerListener - the TimerListener to schedule
        delay - the delay before starting the task for the first time (ms)
        period - the period between repeated task executions (ms)
        fixedRate - whether to schedule as fixed-rate execution
      • ScheduledTimerListener

        public ScheduledTimerListener(java.lang.Runnable timerTask)
        Deprecated. 
        Create a new ScheduledTimerListener, with default one-time execution without delay.
        Parameters:
        timerTask - the Runnable to schedule as TimerListener
      • ScheduledTimerListener

        public ScheduledTimerListener(java.lang.Runnable timerTask,
                                      long delay)
        Deprecated. 
        Create a new ScheduledTimerListener, with default one-time execution with the given delay.
        Parameters:
        timerTask - the Runnable to schedule as TimerListener
        delay - the delay before starting the task for the first time (ms)
      • ScheduledTimerListener

        public ScheduledTimerListener(java.lang.Runnable timerTask,
                                      long delay,
                                      long period,
                                      boolean fixedRate)
        Deprecated. 
        Create a new ScheduledTimerListener.
        Parameters:
        timerTask - the Runnable to schedule as TimerListener
        delay - the delay before starting the task for the first time (ms)
        period - the period between repeated task executions (ms)
        fixedRate - whether to schedule as fixed-rate execution
    • Method Detail

      • setRunnable

        public void setRunnable(java.lang.Runnable timerTask)
        Deprecated. 
        Set the Runnable to schedule as TimerListener.
        See Also:
        DelegatingTimerListener
      • setTimerListener

        public void setTimerListener(@Nullable
                                     commonj.timers.TimerListener timerListener)
        Deprecated. 
        Set the TimerListener to schedule.
      • getTimerListener

        @Nullable
        public commonj.timers.TimerListener getTimerListener()
        Deprecated. 
        Return the TimerListener to schedule.
      • setDelay

        public void setDelay(long delay)
        Deprecated. 
        Set the delay before starting the task for the first time, in milliseconds. Default is 0, immediately starting the task after successful scheduling.

        If the "firstTime" property is specified, this property will be ignored. Specify one or the other, not both.

      • getDelay

        public long getDelay()
        Deprecated. 
        Return the delay before starting the job for the first time.
      • setPeriod

        public void setPeriod(long period)
        Deprecated. 
        Set the period between repeated task executions, in milliseconds.

        Default is -1, leading to one-time execution. In case of zero or a positive value, the task will be executed repeatedly, with the given interval in-between executions.

        Note that the semantics of the period value vary between fixed-rate and fixed-delay execution.

        Note: A period of 0 (for example as fixed delay) is supported, because the CommonJ specification defines this as a legal value. Hence a value of 0 will result in immediate re-execution after a job has finished (not in one-time execution like with java.util.Timer).

        See Also:
        setFixedRate(boolean), isOneTimeTask(), TimerManager.schedule(commonj.timers.TimerListener, long, long)
      • getPeriod

        public long getPeriod()
        Deprecated. 
        Return the period between repeated task executions.
      • isOneTimeTask

        public boolean isOneTimeTask()
        Deprecated. 
        Is this task only ever going to execute once?
        Returns:
        true if this task is only ever going to execute once
        See Also:
        getPeriod()
      • setFixedRate

        public void setFixedRate(boolean fixedRate)
        Deprecated. 
        Set whether to schedule as fixed-rate execution, rather than fixed-delay execution. Default is "false", i.e. fixed delay.

        See TimerManager javadoc for details on those execution modes.

        See Also:
        TimerManager.schedule(commonj.timers.TimerListener, long, long), TimerManager.scheduleAtFixedRate(commonj.timers.TimerListener, long, long)
      • isFixedRate

        public boolean isFixedRate()
        Deprecated. 
        Return whether to schedule as fixed-rate execution.