org.rococoa.contrib.dispatch
Class GCDExecutorService

java.lang.Object
  extended by java.util.concurrent.AbstractExecutorService
      extended by org.rococoa.contrib.dispatch.GCDExecutorService
All Implemented Interfaces:
Executor, ExecutorService

public class GCDExecutorService
extends AbstractExecutorService

GCDExecutorService runs tasks by passing them to Grand Central Dispatch. Presently, every GCDExecutorService creates its own NSOperationQueue underneath.

Author:
Andrew Thompson (lordpixel@mac.com)

Constructor Summary
GCDExecutorService()
          Construct a new instance of the code ExecutorService, with its own underlying NSOperationQueue
 
Method Summary
 boolean awaitTermination(long timeout, TimeUnit unit)
           
 void execute(Runnable command)
           
 boolean isShutdown()
           
 boolean isTerminated()
           
protected
<T> RunnableFuture<T>
newTaskFor(Callable<T> callable)
           
protected
<T> RunnableFuture<T>
newTaskFor(Runnable runnable, T value)
           
 void shutdown()
           
 List<Runnable> shutdownNow()
           
 
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GCDExecutorService

public GCDExecutorService()
Construct a new instance of the code ExecutorService, with its own underlying NSOperationQueue

Method Detail

shutdown

public void shutdown()

shutdownNow

public List<Runnable> shutdownNow()

isShutdown

public boolean isShutdown()

isTerminated

public boolean isTerminated()

awaitTermination

public boolean awaitTermination(long timeout,
                                TimeUnit unit)
                         throws InterruptedException
Throws:
InterruptedException

execute

public void execute(Runnable command)

newTaskFor

protected <T> RunnableFuture<T> newTaskFor(Runnable runnable,
                                           T value)
Overrides:
newTaskFor in class AbstractExecutorService

newTaskFor

protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable)
Overrides:
newTaskFor in class AbstractExecutorService


Copyright © 2012. All Rights Reserved.