O - The type of object for which to run.public class ObjectOneWorkRunnable<O> extends AbstractObjectRunnable<O,O,Pair<java.lang.Runnable,java.lang.Runnable>>
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
blockUntilFlush
Whether work should be blocked for the object of this runnable until the next flush.
|
protected java.util.concurrent.Executor |
executor
The executor to which to add this
ObjectRunnable in case there is more work for
the object. |
protected java.util.concurrent.atomic.AtomicInteger |
flushPending
The amount of pending flushs.
|
logger, objects, terminate| Modifier | Constructor and Description |
|---|---|
protected |
ObjectOneWorkRunnable(O object,
boolean blockUntilFlush,
ObjectOneWorkExecutor<O> executor,
java.util.concurrent.atomic.AtomicInteger terminate,
java.util.concurrent.atomic.AtomicInteger flushPending,
java.util.logging.Logger logger)
Creates a new runnable that executes one runnable for a specific object.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
runForObject()
Runs this runnable actually.
|
awaitTermination, getIndexObject, getRegisteredObject, runprotected final java.util.concurrent.Executor executor
ObjectRunnable in case there is more work for
the object. Re-adding instead of executing the work prevents starvation of work for specific
objects.protected final boolean blockUntilFlush
protected final java.util.concurrent.atomic.AtomicInteger flushPending
AbstractObjectRunnable.objects.protected ObjectOneWorkRunnable(O object, boolean blockUntilFlush, ObjectOneWorkExecutor<O> executor, java.util.concurrent.atomic.AtomicInteger terminate, java.util.concurrent.atomic.AtomicInteger flushPending, java.util.logging.Logger logger)
object - The object of this runnable.blockUntilFlush - Whether work should be blocked for the object of this runnable until the
next flush. Otherwise work is allowed as soon as this runnable is started.executor - The executor to which to add this ObjectRunnable in case there is
more work for the object.terminate - The amount of termination requests. This allows for synchronising across
different objects.flushPending - The amount of pending flushs. If a flush is pending, work for the same
object has to be executed by the same runnable (and thread) instead of re-scheduling
it.logger - The logger which to use for runtime exceptions stemming from a executing a
runnable. Such an exception will only be logged.protected boolean runForObject()
AbstractObjectRunnablerunForObject in class AbstractObjectRunnable<O,O,Pair<java.lang.Runnable,java.lang.Runnable>>true,
only return false if you want to continue to work without interruption,
e.g. to change the executing thread.