org.elasticsearch.common.util.concurrent
Class TransferThreadPoolExecutor

java.lang.Object
  extended by java.util.concurrent.AbstractExecutorService
      extended by org.elasticsearch.common.util.concurrent.TransferThreadPoolExecutor
All Implemented Interfaces:
java.util.concurrent.Executor, java.util.concurrent.ExecutorService

public class TransferThreadPoolExecutor
extends java.util.concurrent.AbstractExecutorService

A thread pool based on TransferQueue.

Limited compared to ExecutorServer in what it does, but focused on speed.


Method Summary
 boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)
           
 void execute(java.lang.Runnable command)
           
 int getActiveCount()
          Returns the approximate number of threads that are actively executing tasks.
 int getCorePoolSize()
           
 int getMaximumPoolSize()
           
 int getPoolSize()
          Returns the current number of threads in the pool.
 int getQueueSize()
           
 boolean isShutdown()
           
 boolean isTerminated()
           
static TransferThreadPoolExecutor newBlockingExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, long blockingTime, java.util.concurrent.TimeUnit blockingUnit, int blockingCapacity, java.util.concurrent.ThreadFactory threadFactory)
           
static TransferThreadPoolExecutor newScalingExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.ThreadFactory threadFactory)
           
 void shutdown()
           
 java.util.List<java.lang.Runnable> shutdownNow()
           
 
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, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newScalingExecutor

public static TransferThreadPoolExecutor newScalingExecutor(int corePoolSize,
                                                            int maximumPoolSize,
                                                            long keepAliveTime,
                                                            java.util.concurrent.TimeUnit unit,
                                                            java.util.concurrent.ThreadFactory threadFactory)

newBlockingExecutor

public static TransferThreadPoolExecutor newBlockingExecutor(int corePoolSize,
                                                             int maximumPoolSize,
                                                             long keepAliveTime,
                                                             java.util.concurrent.TimeUnit unit,
                                                             long blockingTime,
                                                             java.util.concurrent.TimeUnit blockingUnit,
                                                             int blockingCapacity,
                                                             java.util.concurrent.ThreadFactory threadFactory)

execute

public void execute(java.lang.Runnable command)

shutdown

public void shutdown()

shutdownNow

public java.util.List<java.lang.Runnable> shutdownNow()

isShutdown

public boolean isShutdown()

isTerminated

public boolean isTerminated()

awaitTermination

public boolean awaitTermination(long timeout,
                                java.util.concurrent.TimeUnit unit)
                         throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

getPoolSize

public int getPoolSize()
Returns the current number of threads in the pool.

Returns:
the number of threads

getActiveCount

public int getActiveCount()
Returns the approximate number of threads that are actively executing tasks.

Returns:
the number of threads

getCorePoolSize

public int getCorePoolSize()

getMaximumPoolSize

public int getMaximumPoolSize()

getQueueSize

public int getQueueSize()