com.octo.android.robospice.priority
Class PausableThreadPoolExecutor

java.lang.Object
  extended by java.util.concurrent.AbstractExecutorService
      extended by java.util.concurrent.ThreadPoolExecutor
          extended by com.octo.android.robospice.priority.PausableThreadPoolExecutor
All Implemented Interfaces:
Executor, ExecutorService
Direct Known Subclasses:
PriorityThreadPoolExecutor

public class PausableThreadPoolExecutor
extends ThreadPoolExecutor

This class is used internally. It makes testing easier.

Author:
SNI

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
 
Constructor Summary
PausableThreadPoolExecutor(int poolSize)
          Creates a thread pool executor with a PausablePriorityBlockingQueue and low priority threads.
PausableThreadPoolExecutor(int poolSize, int threadPriority)
          Creates a thread pool executor with a PausablePriorityBlockingQueue.
PausableThreadPoolExecutor(int corePoolSize, int maxPoolSize, int threadPriority)
          Creates a thread pool executor with a PausablePriorityBlockingQueue.
 
Method Summary
 void pause()
           
 void resume()
           
 
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated
 
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PausableThreadPoolExecutor

public PausableThreadPoolExecutor(int corePoolSize,
                                  int maxPoolSize,
                                  int threadPriority)
Creates a thread pool executor with a PausablePriorityBlockingQueue.

Parameters:
corePoolSize - the size of the pool of threads.
maxPoolSize - the size of the pool of threads.
threadPriority - the priority of threads created as defined by Thread.setPriority(int).

PausableThreadPoolExecutor

public PausableThreadPoolExecutor(int poolSize,
                                  int threadPriority)
Creates a thread pool executor with a PausablePriorityBlockingQueue.

Parameters:
poolSize - the size of the pool of threads.
threadPriority - the priority of threads created as defined by Thread.setPriority(int).

PausableThreadPoolExecutor

public PausableThreadPoolExecutor(int poolSize)
Creates a thread pool executor with a PausablePriorityBlockingQueue and low priority threads.

Parameters:
poolSize - the size of the pool of threads.
Method Detail

pause

public void pause()

resume

public void resume()


Copyright © 2012-2014. All Rights Reserved.