public final class GlobalDispatchQueue extends java.lang.Object implements HawtDispatchQueue
DispatchQueue.QueueType| Modifier and Type | Field and Description |
|---|---|
HawtDispatcher |
dispatcher |
(package private) java.lang.String |
label |
private DispatchPriority |
priority |
(package private) WorkerPool |
workers |
| Constructor and Description |
|---|
GlobalDispatchQueue(HawtDispatcher dispatcher,
DispatchPriority priority,
int threads) |
| Modifier and Type | Method and Description |
|---|---|
void |
assertExecuting()
Asserts that the current dispatch queue is executing.
|
DispatchQueue |
createQueue(java.lang.String label)
Creates a new serial dispatch queue with this queue set as it's
target queue.
|
void |
execute(java.lang.Runnable runnable)
Deprecated.
|
void |
execute(Task task)
Submits a task for asynchronous execution on a dispatch queue.
|
void |
executeAfter(long delay,
java.util.concurrent.TimeUnit unit,
java.lang.Runnable runnable)
Deprecated.
|
void |
executeAfter(long delay,
java.util.concurrent.TimeUnit unit,
Task task)
Schedule a task for execution on a given queue at a specified time.
|
HawtDispatcher |
getDispatcher() |
java.lang.String |
getLabel()
Returns the label of the queue.
|
DispatchPriority |
getPriority() |
DispatchQueue.QueueType |
getQueueType() |
java.util.LinkedList<Task> |
getSourceQueue() |
ThreadDispatchQueue |
getTargetQueue()
Gets the target queue for this object.
|
(package private) DispatchQueue[] |
getThreadQueues() |
boolean |
isExecuting()
Returns true if this dispatch queue is executing the caller.
|
GlobalDispatchQueue |
isGlobalDispatchQueue() |
SerialDispatchQueue |
isSerialDispatchQueue() |
boolean |
isSuspended() |
ThreadDispatchQueue |
isThreadDispatchQueue() |
Metrics |
metrics()
Returns the usage metrics of this queue.
|
boolean |
profile() |
void |
profile(boolean profile)
Enables or disables profiler metric tracking on the queue.
|
void |
resume()
Resumes the invocation of tasks on a dispatch object.
|
void |
setLabel(java.lang.String label)
Sets the label of the queue.
|
void |
setTargetQueue(DispatchQueue queue)
Sets the target queue for this object.
|
void |
shutdown() |
void |
start() |
void |
suspend()
Suspends the invocation of tasks on a dispatch object.
|
java.lang.String |
toString() |
public final HawtDispatcher dispatcher
volatile java.lang.String label
private final DispatchPriority priority
final WorkerPool workers
public GlobalDispatchQueue(HawtDispatcher dispatcher, DispatchPriority priority, int threads)
public void start()
public void shutdown()
public HawtDispatcher getDispatcher()
getDispatcher in interface HawtDispatchQueuepublic java.lang.String getLabel()
DispatchQueueReturns the label of the queue.
getLabel in interface DispatchQueuepublic void setLabel(java.lang.String label)
DispatchQueueSets the label of the queue.
setLabel in interface DispatchQueuelabel - the label of the queue.public boolean isExecuting()
DispatchQueueReturns true if this dispatch queue is executing the caller.
isExecuting in interface DispatchQueuepublic java.util.LinkedList<Task> getSourceQueue()
getSourceQueue in interface HawtDispatchQueuepublic void assertExecuting()
DispatchQueueassertExecuting in interface DispatchQueue@Deprecated public void execute(java.lang.Runnable runnable)
DispatchQueueSubmits a runnable for asynchronous execution on a dispatch queue.
DispatchQueue.execute(Runnable) is the fundamental mechanism for submitting
runnable objects to a dispatch queue.
Calls to DispatchQueue.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.
execute in interface java.util.concurrent.Executorexecute in interface DispatchQueuerunnable - The runnable to submit to the dispatch queue.@Deprecated
public void executeAfter(long delay,
java.util.concurrent.TimeUnit unit,
java.lang.Runnable runnable)
DispatchQueueSchedule a runnable for execution on a given queue at a specified time.
executeAfter in interface DispatchQueuedelay - the amount of time to delay before executing the runnableunit - the unit of time that the delay value is specified inpublic void execute(Task task)
DispatchQueueSubmits a task for asynchronous execution on a dispatch queue.
DispatchQueue.execute(Task) is the fundamental mechanism for submitting
runnable objects to a dispatch queue.
Calls to DispatchQueue.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.
execute in interface DispatchQueuetask - The task to submit to the dispatch queue.public void executeAfter(long delay,
java.util.concurrent.TimeUnit unit,
Task task)
DispatchQueueSchedule a task for execution on a given queue at a specified time.
executeAfter in interface DispatchQueuedelay - the amount of time to delay before executing the runnableunit - the unit of time that the delay value is specified inpublic ThreadDispatchQueue getTargetQueue()
DispatchObjectGets the target queue for this object.
getTargetQueue in interface DispatchObjectgetTargetQueue in interface HawtDispatchQueueDispatchObject.setTargetQueue(DispatchQueue)public DispatchPriority getPriority()
public void resume()
SuspendableResumes the invocation of tasks on a dispatch object.
resume in interface SuspendableSuspendable.suspend()public void suspend()
SuspendableSuspends the invocation of tasks on a dispatch object.
A suspended object will not invoke any tasks associated with it. The suspension of an object will occur after any running runnable associated with the object completes.
Calls to Suspendable.suspend() must be balanced with calls
to Suspendable.resume().
suspend in interface SuspendableSuspendable.resume()public boolean isSuspended()
isSuspended in interface SuspendableSuspendable.resume(),
Suspendable.suspend()public void setTargetQueue(DispatchQueue queue)
DispatchObjectSets the target queue for this object.
An object's target queue is responsible for processing the object.
A dispatch queue's priority is inherited by its target queue. Use the
Dispatch.getGlobalQueue() method to obtain suitable target queue
of the desired priority.
A dispatch source's target queue specifies where its event handler and cancellation handler runnables will be submitted.
setTargetQueue in interface DispatchObjectqueue - The new target queue for the object. The queue is retained, and the
previous one, if any, is released.
The result of passing NULL in this parameter is undefined.public GlobalDispatchQueue isGlobalDispatchQueue()
isGlobalDispatchQueue in interface HawtDispatchQueuepublic SerialDispatchQueue isSerialDispatchQueue()
isSerialDispatchQueue in interface HawtDispatchQueuepublic ThreadDispatchQueue isThreadDispatchQueue()
isThreadDispatchQueue in interface HawtDispatchQueuepublic java.lang.String toString()
toString in class java.lang.Objectpublic DispatchQueue createQueue(java.lang.String label)
DispatchQueue
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.
createQueue in interface DispatchQueuelabel - the label to assign the dispatch queue, can be nullpublic DispatchQueue.QueueType getQueueType()
getQueueType in interface DispatchQueueDispatchQueue[] getThreadQueues()
public void profile(boolean profile)
DispatchQueueprofile in interface DispatchQueuepublic boolean profile()
profile in interface DispatchQueuepublic Metrics metrics()
DispatchQueuemetrics in interface DispatchQueue