-
- 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.
-
-
Constructor Summary
Constructors Constructor Description PeriodicRunnable(long period)Initializes a new {@code PeriodicRunnable}instance which is to haveits run invoked at a specific interval/period.PeriodicRunnable(long period, boolean invokeImmediately)Initializes a new {@code PeriodicRunnable}instance which is to haveits run invoked at a specific interval/period.
-
Method Summary
Modifier and Type Method Description final longgetLastProcessTime()Gets the last time in milliseconds at which run was invoked. final longgetPeriod()Gets the interval/period in milliseconds at which run is tobe invoked. voidsetPeriod(long period)Sets the period in milliseconds at which run is to be invoked.Note that the change may not take effect immediately. longgetTimeUntilNextRun()Returns the number of milliseconds until this instance wants a workerthread to call #run(). voidrun()Updates _lastProcessTime. -
-
Constructor Detail
-
PeriodicRunnable
PeriodicRunnable(long period)
Initializes a new{@code PeriodicRunnable}instance which is to haveits 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{@code PeriodicRunnable}instance which is to haveits run invoked at a specific interval/period.- Parameters:
period- the interval/period in milliseconds at which run is to be invokedinvokeImmediately- whether to invoke the runnable immediately orwait for one{@code period}before the first invocation.
-
-
Method Detail
-
getLastProcessTime
final long getLastProcessTime()
Gets the last time in milliseconds at which run was invoked.
-
getPeriod
final long getPeriod()
Gets the interval/period in milliseconds at which run is tobe 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 workerthread to call #run(). The method is called on the sameworker thread as Process will be called on.
-
run
void run()
Updates _lastProcessTime.
-
-
-
-