See: Description
Interface | Description |
---|---|
DispatchCallable<ReturnType> |
Convenience interface so the dispatch package is self-contained
|
DispatchIterationKernel |
DispatchIterationKernel
|
Class | Description |
---|---|
DispatchGroup |
DispatchGroup
|
DispatchQueue |
DispatchQueue which attempts to implement a subset of the open source libdispatch library
|
DispatchTimer |
DispatchTimer
|
Enum | Description |
---|---|
DispatchQueue.DispatchQueueState |
possible states of the dispatch queue
|
DispatchTimer.DispatchTimerMode |
possible dispatch modes
|
Snippet | Description |
---|---|
DispatchQueue queue = DispatchQueue.createConcurrentQueue( "Demo Concurrent" ) | Create a new concurrent dispatch queue. |
DispatchQueue queue = DispatchQueue.createSerialQueue( "Demo Serial" ) | Create a new serial dispatch queue. |
DispatchQueue queue = DispatchQueue.getGlobalDefaultPriorityQueue() | Get the global dispatch queue with default priority. |
DispatchQueue queue = DispatchQueue.getMainQueue() | Get the main dispatch queue (schedules on the Swing thread). |
queue.dispatchAsync( runnableOperation ) | Submit the operation to the queue without waiting for it to complete. |
queue.dispatchAfter( time, runnableOperation ) | Submit the operation to the queue after the specified time without waiting for it to complete. |
queue.dispatchSync( runnableOperation ) | Submit the operation to the queue and wait for it to complete. |
queue.dispatchSync( callableOperation ) | Submit the operation to the queue, wait for it to complete and return the result. |
queue.dispatchBarrierAsync( runnableOperation ) | Submit the operation to the queue without waiting for it to complete. The barrier operation will not execute until all operations ahead of it in the queue complete. No other operation will execute concurrently with the barrier operation on the same queue. Operations after the barrier in the queue will execute after the barrier completes. |
queue.dispatchBarrierSync( runnableOperation ) | Submit the operation to the queue and wait for it to complete. The barrier operation will not execute until all operations ahead of it in the queue complete. No other operation will execute concurrently with the barrier operation on the same queue. Operations after the barrier in the queue will execute after the barrier completes. |
DispatchGroup group = new DispatchGroup() | Create a new dispatch group. |
group.enter() | Add any operations to the group which are subsequently dispatched. |
group.leave() | Stop adding operations to the group. |
queue.dispatchAsync( group, runnableOperation ) | Convenience method to submit the operation to the queue without waiting for it to complete and add the operation to the group. |
group.waitForCompletion() | Wait until all operations associated with the group have completed. |