public class TaskRegister extends Object implements TaskRegistry
Constructor and Description |
---|
TaskRegister() |
Modifier and Type | Method and Description |
---|---|
int |
getRegistrySize()
Returns the size of the
TaskRegistry , represented as a signed 8, 16, or 32 bit integer. |
void |
interruptAll()
interuptAll() implementation is the subject of (#79), and as such MAY be
addressed prior to release of v0.1.0.
|
void |
offer(Task<?>... tasks)
Inserts the specified element into this
TaskRegistry . |
void |
offer(Task<?> task)
Inserts the specified element into this
TaskRegistry . |
Task<?> |
pollTask() |
boolean |
remove(Task<?> task)
Removes a single instance of the specified
Task from this TaskRegistry ,
if it is present. |
public void offer(Task<?> task)
TaskRegistry
TaskRegistry
. On average, the performance runtime of this
method is O(1).offer
in interface TaskRegistry
task
- - The Task
to be inserted.offer(Task)
@SafeVarargs public final void offer(Task<?>... tasks)
TaskRegistry
. This is the varargs
implementation
of TaskRegistry.offer(Task)
, meaning that it handles all instances where there are either 0 or >1 parameter
arguments present.
Task
from
entering the TaskRegistry
. The reason for this inclusion is to prevent a null Task
from consuming computing resources, including worker threads and memory. Note that this scan and check
may spawn 0 or more worker threads to achieve efficient, high-performance checking. As a result of this scan,
one can expect an asymptotic runtime upper bounding (worse-case performance) of O(n), where n
is the number of elements present in this method's parameter{s). For the O(1) implementation of this method, please
refer to offer(Task)
.offer
in interface TaskRegistry
tasks
- - The set of zero or more Task
to be inserted into this registry.public boolean remove(Task<?> task)
TaskRegistry
Task
from this TaskRegistry
,
if it is present. More formally, removes a Task task
such that task
is no longer
present in the TaskRegistry
if this TaskRegistry
contains one or more such elements.remove
in interface TaskRegistry
task
- - The Task
to be removed.public Task<?> pollTask()
pollTask
in interface TaskRegistry
public void interruptAll()
interruptAll
in interface TaskRegistry
public int getRegistrySize()
TaskRegistry
, represented as a signed 8, 16, or 32 bit integer. The
value will be an 8-bit integer for sizes of less than and including 255. For values greater than 255
but less than 32,767 this will be 16 bits. Finally, for values greater than 32,767 up to the maximum integer
, the value will contain 32 bits.getRegistrySize
in interface TaskRegistry
Copyright © 2020. All rights reserved.