com.bumptech.glide.load.engine.executor
Class FifoPriorityThreadPoolExecutor

java.lang.Object
  extended by java.util.concurrent.AbstractExecutorService
      extended by java.util.concurrent.ThreadPoolExecutor
          extended by com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor
All Implemented Interfaces:
Executor, ExecutorService

public class FifoPriorityThreadPoolExecutor
extends ThreadPoolExecutor

A FIFO priority ThreadPoolExecutor that prioritizes submitted Runnables by assuming they implement Prioritized. Prioritized runnables that return lower values for Prioritized.getPriority() will be executed before those that return higher values. Priorities only apply when multiple items are queued at the same time. Runnables with the same priority will be executed in FIFO order.


Nested Class Summary
static class FifoPriorityThreadPoolExecutor.DefaultThreadFactory
          A ThreadFactory that builds threads with priority Process.THREAD_PRIORITY_BACKGROUND.
 
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
 
Constructor Summary
FifoPriorityThreadPoolExecutor(int poolSize)
          Constructor to build a fixed thread pool with the given pool size using FifoPriorityThreadPoolExecutor.DefaultThreadFactory.
FifoPriorityThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAlive, TimeUnit timeUnit, ThreadFactory threadFactory)
           
 
Method Summary
protected
<T> RunnableFuture<T>
newTaskFor(Runnable runnable, T value)
           
 
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, submit, submit, submit
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FifoPriorityThreadPoolExecutor

public FifoPriorityThreadPoolExecutor(int poolSize)
Constructor to build a fixed thread pool with the given pool size using FifoPriorityThreadPoolExecutor.DefaultThreadFactory.

Parameters:
poolSize - The number of threads.

FifoPriorityThreadPoolExecutor

public FifoPriorityThreadPoolExecutor(int corePoolSize,
                                      int maximumPoolSize,
                                      long keepAlive,
                                      TimeUnit timeUnit,
                                      ThreadFactory threadFactory)
Method Detail

newTaskFor

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