public abstract class PeriodicRunnable extends java.lang.Object implements RecurringRunnable
RecurringRunnable
which has its
Runnable.run()
invoked at a specific interval/period.Constructor and 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. |
Modifier and Type | Method and Description |
---|---|
long |
getLastProcessTime()
Gets the last time in milliseconds at which
run() was invoked. |
long |
getPeriod()
Gets the interval/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
Runnable.run() . |
void |
run()
Updates
_lastProcessTime . |
void |
setPeriod(long period)
Sets the period in milliseconds at which
run() is to be invoked. |
public PeriodicRunnable(long period)
PeriodicRunnable
instance which is to have
its run()
invoked at a specific interval/period.period
- the interval/period in milliseconds at which
run()
is to be invokedpublic PeriodicRunnable(long period, boolean invokeImmediately)
PeriodicRunnable
instance which is to have
its run()
invoked at a specific interval/period.period
- the interval/period in milliseconds at which
run()
is to be invokedinvokeImmediately
- whether to invoke the runnable immediately or
wait for one period
before the first invocation.public final long getLastProcessTime()
run()
was invoked.run()
was
invokedpublic final long getPeriod()
run()
is to
be invoked.run()
is
to be invokedpublic void setPeriod(long period)
run()
is to be invoked.
Note that the change may not take effect immediately.period
- the period to set.public long getTimeUntilNextRun()
Runnable.run()
. The method is called on the same
worker thread as Process will be called on.getTimeUntilNextRun
in interface RecurringRunnable
Runnable.run()
public void run()
_lastProcessTime
.run
in interface java.lang.Runnable
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.