|
GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java (public API).
|
A re-start()'able, pause(boolean)'able and interrupt'able worker thread with an optional minimum execution duration, see getSleptDuration() executing a task periodically.
More...
Classes | |
| interface | Callback |
An interruptible task periodically executed on the WorkerThread thread. More... | |
| interface | StateCallback |
An interruptible State task on the WorkerThread thread. More... | |
Public Member Functions | |
| WorkerThread (final Duration minPeriod, final Duration minDelay, final boolean daemonThread, final Callback work) | |
Instantiates a new WorkerThread. More... | |
| WorkerThread (final Duration minPeriod, final Duration minDelay, final boolean daemonThread, final Callback work, final StateCallback stateChangeCB) | |
Instantiates a new WorkerThread. More... | |
| final synchronized void | start (final boolean paused) |
Starts execution of a new worker thread if not isRunning, i.e. More... | |
| final synchronized void | stop (final boolean waitUntilDone) |
Stops execution of the start()'ed worker thread. More... | |
| final synchronized void | pause (final boolean waitUntilDone) |
Pauses execution of the start()'ed worker thread. More... | |
| final synchronized void | resume () |
Resumes execution of the pause(boolean)'ed worker thread. More... | |
| final boolean | isRunning () |
Returns true if the worker thread has started via start() and has not ended, e.g. More... | |
| final boolean | isActive () |
Returns true if the worker thread isRunning() and is not paused. More... | |
| final boolean | isPaused () |
Returns true if the worker thread isRunning() and is paused. More... | |
| final boolean | hasError () |
Returns true if an exception occured during Callable work execution. More... | |
| final Thread | getThread () |
Returns the worker thread if isRunning(), otherwise null. More... | |
| final Exception | getError (final boolean clear) |
Returns the exception is hasError(). More... | |
| final Duration | getMinPeriod () |
Returns enforced minimum work-loop-period or Duration#ZERO for none. More... | |
| final Duration | getMinDelay () |
Returns enforced minimum work-loop-delay or Duration#ZERO for none. More... | |
| final Duration | getSleptDuration () |
Returns the slept Duration delta of getMinPeriod() and consumed Callback#run() duration, which minimum is getMinDelay(). More... | |
| String | toString () |
A re-start()'able, pause(boolean)'able and interrupt'able worker thread with an optional minimum execution duration, see getSleptDuration() executing a task periodically.
Optionally a state task can be given for fine grained control.
If an exception occurs during execution of the work Callback, the worker thread is pause(boolean)'ed and hasError() as well as getError(boolean) can be used to query and clear the state. User may resume() or stop() the thread.
If an exception occurs during execution of the optional state task, the worker thread is stop()'ed and hasError() as well as getError(boolean) can be used to query and clear the state.
Definition at line 55 of file WorkerThread.java.
| com.jogamp.common.util.WorkerThread.WorkerThread | ( | final Duration | minPeriod, |
| final Duration | minDelay, | ||
| final boolean | daemonThread, | ||
| final Callback | work | ||
| ) |
Instantiates a new WorkerThread.
| minPeriod | minimum work-loop-period to throttle execution or null if unthrottled, see getSleptDuration() |
| minDelay | minimum work-loop-delay to throttle execution or null if unthrottled, see getSleptDuration() |
| daemonThread | argument for Thread#setDaemon(boolean) |
| work | the actual work Callback to perform. |
Definition at line 115 of file WorkerThread.java.
| com.jogamp.common.util.WorkerThread.WorkerThread | ( | final Duration | minPeriod, |
| final Duration | minDelay, | ||
| final boolean | daemonThread, | ||
| final Callback | work, | ||
| final StateCallback | stateChangeCB | ||
| ) |
Instantiates a new WorkerThread.
| minPeriod | minimum work-loop-period to throttle execution or null if unthrottled, see getSleptDuration() |
| minDelay | minimum work-loop-delay to throttle execution or null if unthrottled, see getSleptDuration() |
| daemonThread | argument for Thread#setDaemon(boolean) |
| work | the actual work Callback to perform. |
| stateChangeCB | optional StateCallback called at different StateCallback.State changes while locked |
Definition at line 127 of file WorkerThread.java.
| final Exception com.jogamp.common.util.WorkerThread.getError | ( | final boolean | clear | ) |
Returns the exception is hasError().
| clear | if true, clear the exception |
Definition at line 266 of file WorkerThread.java.
| final Duration com.jogamp.common.util.WorkerThread.getMinDelay | ( | ) |
Returns enforced minimum work-loop-delay or Duration#ZERO for none.
Definition at line 278 of file WorkerThread.java.
| final Duration com.jogamp.common.util.WorkerThread.getMinPeriod | ( | ) |
Returns enforced minimum work-loop-period or Duration#ZERO for none.
Definition at line 272 of file WorkerThread.java.
| final Duration com.jogamp.common.util.WorkerThread.getSleptDuration | ( | ) |
Returns the slept Duration delta of getMinPeriod() and consumed Callback#run() duration, which minimum is getMinDelay().
Returns zero for zero getMinPeriod() and getMinDelay() or exceeding Callback#run() duration without getMinDelay().
Definition at line 288 of file WorkerThread.java.
| final Thread com.jogamp.common.util.WorkerThread.getThread | ( | ) |
Returns the worker thread if isRunning(), otherwise null.
Definition at line 260 of file WorkerThread.java.
| final boolean com.jogamp.common.util.WorkerThread.hasError | ( | ) |
Returns true if an exception occured during Callable work execution.
Definition at line 258 of file WorkerThread.java.
| final boolean com.jogamp.common.util.WorkerThread.isActive | ( | ) |
Returns true if the worker thread isRunning() and is not paused.
Definition at line 254 of file WorkerThread.java.
| final boolean com.jogamp.common.util.WorkerThread.isPaused | ( | ) |
Returns true if the worker thread isRunning() and is paused.
Definition at line 256 of file WorkerThread.java.
| final boolean com.jogamp.common.util.WorkerThread.isRunning | ( | ) |
Returns true if the worker thread has started via start() and has not ended, e.g.
via stop(). It might be paused.
Definition at line 252 of file WorkerThread.java.
| final synchronized void com.jogamp.common.util.WorkerThread.pause | ( | final boolean | waitUntilDone | ) |
Pauses execution of the start()'ed worker thread.
Method blocks until worker thread has been isActive()'ated if waitUntilDone is true.
Definition at line 213 of file WorkerThread.java.
| final synchronized void com.jogamp.common.util.WorkerThread.resume | ( | ) |
Resumes execution of the pause(boolean)'ed worker thread.
Definition at line 234 of file WorkerThread.java.
| final synchronized void com.jogamp.common.util.WorkerThread.start | ( | final boolean | paused | ) |
Starts execution of a new worker thread if not isRunning, i.e.
never start()'ed or stop()'ed.
Method blocks until the new worker thread has been started and isRunning() and isActive() if paused == false.
| paused | if true, keeps the new worker thread paused, otherwise resume() it. |
Definition at line 149 of file WorkerThread.java.
| final synchronized void com.jogamp.common.util.WorkerThread.stop | ( | final boolean | waitUntilDone | ) |
Stops execution of the start()'ed worker thread.
Method blocks until worker thread has been stopped if waitUntilDone is true.
Definition at line 186 of file WorkerThread.java.
| String com.jogamp.common.util.WorkerThread.toString | ( | ) |
Definition at line 291 of file WorkerThread.java.