public interface DispatchQueue extends DispatchObject, Executor
Dispatch queues are lightweight objects to which runnable objects
may be submitted for asynchronous execution and therefore are
Executor
objects.
Modifier and Type | Interface and Description |
---|---|
static class |
DispatchQueue.QueueType
Defines the types of dispatch queues supported by the system.
|
Modifier and Type | Method and Description |
---|---|
void |
assertExecuting()
Asserts that the current dispatch queue is executing.
|
DispatchQueue |
createQueue(String label)
Creates a new serial dispatch queue with this queue set as it's
target queue.
|
void |
execute(Runnable runnable)
Submits a runnable for asynchronous execution on a dispatch queue.
|
void |
execute(Task task)
Submits a task for asynchronous execution on a dispatch queue.
|
void |
executeAfter(long delay,
TimeUnit unit,
Runnable runnable)
Schedule a runnable for execution on a given queue at a specified time.
|
void |
executeAfter(long delay,
TimeUnit unit,
Task task)
Schedule a task for execution on a given queue at a specified time.
|
String |
getLabel()
Returns the label of the queue.
|
DispatchQueue.QueueType |
getQueueType() |
boolean |
isExecuting()
Returns true if this dispatch queue is executing the caller.
|
Metrics |
metrics()
Returns the usage metrics of this queue.
|
boolean |
profile() |
void |
profile(boolean on)
Enables or disables profiler metric tracking on the queue.
|
void |
setLabel(String label)
Sets the label of the queue.
|
getTargetQueue, setTargetQueue
isSuspended, resume, suspend
DispatchQueue.QueueType getQueueType()
DispatchQueue createQueue(String label)
Creates a new serial dispatch queue with this queue set as it's
target queue. See Dispatch.createQueue(String)
for
more information about serial dispatch queues.
label
- the label to assign the dispatch queue, can be nullvoid execute(Runnable runnable)
Submits a runnable for asynchronous execution on a dispatch queue.
execute(Runnable)
is the fundamental mechanism for submitting
runnable objects to a dispatch queue.
Calls to execute(Runnable)
always return immediately after the runnable has
been submitted, and never wait for the runnable to be executed.
The target queue determines whether the runnable will be invoked serially or concurrently with respect to other runnables submitted to that same queue. Serial queues are processed concurrently with with respect to each other.
void execute(Task task)
Submits a task for asynchronous execution on a dispatch queue.
execute(Task)
is the fundamental mechanism for submitting
runnable objects to a dispatch queue.
Calls to execute(Task)
always return immediately after the runnable has
been submitted, and never wait for the runnable to be executed.
The target queue determines whether the runnable will be invoked serially or concurrently with respect to other runnables submitted to that same queue. Serial queues are processed concurrently with with respect to each other.
task
- The task to submit to the dispatch queue.void executeAfter(long delay, TimeUnit unit, Runnable runnable)
Schedule a runnable for execution on a given queue at a specified time.
delay
- the amount of time to delay before executing the runnableunit
- the unit of time that the delay value is specified inrunnable
- void executeAfter(long delay, TimeUnit unit, Task task)
Schedule a task for execution on a given queue at a specified time.
delay
- the amount of time to delay before executing the runnableunit
- the unit of time that the delay value is specified intask
- String getLabel()
Returns the label of the queue.
void setLabel(String label)
Sets the label of the queue.
label
- the label of the queue.boolean isExecuting()
Returns true if this dispatch queue is executing the caller.
void assertExecuting()
void profile(boolean on)
on
- boolean profile()
Copyright © 2010–2017 FuseSource, Corp.. All rights reserved.