Class PeriodicRunnable

  • All Implemented Interfaces:
    java.lang.Runnable , org.jitsi.utils.concurrent.RecurringRunnable

    
    public abstract class PeriodicRunnable
     implements RecurringRunnable
                        

    Implements a RecurringRunnable which has its run invoked at a specific interval/period.

    Author:

    Lyubomir Marinov

    Boris Grozev

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      PeriodicRunnable(long period) Initializes a new PeriodicRunnable instance which is to have its run invoked at a specific interval/period.
      PeriodicRunnable(long period, boolean invokeImmediately) Initializes a new PeriodicRunnable instance which is to have its run invoked at a specific interval/period.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final long getLastProcessTime() Gets the last time in milliseconds at which run was invoked.
      final long getPeriod() Gets the interval/period in milliseconds at which run is to be invoked.
      void setPeriod(long period) Sets the period in milliseconds at which run is to be invoked.
      long getTimeUntilNextRun() Returns the number of milliseconds until this instance wants a worker thread to call #run().
      void run() Updates _lastProcessTime.
      • Methods inherited from class java.lang.Object

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

      • PeriodicRunnable

        PeriodicRunnable(long period)
        Initializes a new PeriodicRunnable instance which is to have its run invoked at a specific interval/period.
        Parameters:
        period - the interval/period in milliseconds at which run is to be invoked
      • PeriodicRunnable

        PeriodicRunnable(long period, boolean invokeImmediately)
        Initializes a new PeriodicRunnable instance which is to have its run invoked at a specific interval/period.
        Parameters:
        period - the interval/period in milliseconds at which run is to be invoked
        invokeImmediately - whether to invoke the runnable immediately or wait for one period before the first invocation.
    • Method Detail

      • getLastProcessTime

         final long getLastProcessTime()

        Gets the last time in milliseconds at which run was invoked.

        Returns:

        the last time in milliseconds at which run was invoked

      • getPeriod

         final long getPeriod()

        Gets the interval/period in milliseconds at which run is to be invoked.

        Returns:

        the interval/period in milliseconds at which run is to be invoked

      • setPeriod

         void setPeriod(long period)

        Sets the period in milliseconds at which run is to be invoked. Note that the change may not take effect immediately.

        Parameters:
        period - the period to set.
      • getTimeUntilNextRun

         long getTimeUntilNextRun()

        Returns the number of milliseconds until this instance wants a worker thread to call #run(). The method is called on the same worker thread as Process will be called on.

      • run

         void run()

        Updates _lastProcessTime.