public final class Threading extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Threading.RecurringCallback
Interface that a callback handler needs to implement.
|
static interface |
Threading.RecurringCallbackAccess
Provides methods that are available during the execution of a
Threading.RecurringCallback . |
Modifier and Type | Method and Description |
---|---|
static void |
registerRecurringCallback(long interval,
TimeUnit unit,
Threading.RecurringCallback callback)
Registers a
callback handler that is called by the current thread
approximately at the provided interval. |
public static void registerRecurringCallback(long interval, TimeUnit unit, Threading.RecurringCallback callback)
callback handler
that is called by the current thread
approximately at the provided interval. Only one callback can be active per thread. Each
thread can have its own callback with a different interval (or none at all). No guarantees
are made about the actual interval. For example, when the thread is waiting for a lock or
executing native code, no callback can be done. Exceptions that are thrown during the
execution of the callback are caught and ignored, unless they are thrown via a call to
Threading.RecurringCallbackAccess.throwException(Throwable)
.
Specifying null
for callback
clears the current thread's callback (in which
case, the values of interval
and unit
are ignored).