org.apache.axis2.transport.base.threads.watermark
Class WaterMarkExecutor

java.lang.Object
  extended by java.util.concurrent.AbstractExecutorService
      extended by java.util.concurrent.ThreadPoolExecutor
          extended by org.apache.axis2.transport.base.threads.watermark.WaterMarkExecutor
All Implemented Interfaces:
java.util.concurrent.Executor, java.util.concurrent.ExecutorService

public class WaterMarkExecutor
extends java.util.concurrent.ThreadPoolExecutor

An ExecutorService that executes each submitted task using one of possibly several pooled threads, but the execution happens differently from the ThreadPoolExecutor. In this executor after all the core pool threads are used queuing happens until the water mark. If the more tasks are submitted after the queue is filled up to the water mark the number of threads increases to max. If the number of tasks continue to increase the Queue begins to fill up. If the queue is a bounded queue and the queue is completely filled a RejectedExecutionHandler is executed if one specified. Otherwise the task is rejected.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
 
Constructor Summary
WaterMarkExecutor(int core, int max, long keepAlive, java.util.concurrent.TimeUnit timeUnit, WaterMarkQueue<java.lang.Runnable> queue)
           
WaterMarkExecutor(int core, int max, long keepAlive, java.util.concurrent.TimeUnit timeUnit, WaterMarkQueue<java.lang.Runnable> queue, java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
           
WaterMarkExecutor(int core, int max, long keepAlive, java.util.concurrent.TimeUnit timeUnit, WaterMarkQueue<java.lang.Runnable> queue, java.util.concurrent.ThreadFactory threadFactory)
           
WaterMarkExecutor(int core, int max, long keepAlive, java.util.concurrent.TimeUnit timeUnit, WaterMarkQueue<java.lang.Runnable> queue, java.util.concurrent.ThreadFactory threadFactory, java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
           
 
Method Summary
protected  void beforeExecute(java.lang.Thread t, java.lang.Runnable r)
           
 
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, 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

WaterMarkExecutor

public WaterMarkExecutor(int core,
                         int max,
                         long keepAlive,
                         java.util.concurrent.TimeUnit timeUnit,
                         WaterMarkQueue<java.lang.Runnable> queue)

WaterMarkExecutor

public WaterMarkExecutor(int core,
                         int max,
                         long keepAlive,
                         java.util.concurrent.TimeUnit timeUnit,
                         WaterMarkQueue<java.lang.Runnable> queue,
                         java.util.concurrent.ThreadFactory threadFactory)

WaterMarkExecutor

public WaterMarkExecutor(int core,
                         int max,
                         long keepAlive,
                         java.util.concurrent.TimeUnit timeUnit,
                         WaterMarkQueue<java.lang.Runnable> queue,
                         java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)

WaterMarkExecutor

public WaterMarkExecutor(int core,
                         int max,
                         long keepAlive,
                         java.util.concurrent.TimeUnit timeUnit,
                         WaterMarkQueue<java.lang.Runnable> queue,
                         java.util.concurrent.ThreadFactory threadFactory,
                         java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
Method Detail

beforeExecute

protected void beforeExecute(java.lang.Thread t,
                             java.lang.Runnable r)
Overrides:
beforeExecute in class java.util.concurrent.ThreadPoolExecutor


Copyright © 2004-2014 The Apache Software Foundation. All Rights Reserved.