org.apache.mina.filter.executor

## Class OrderedThreadPoolExecutor

- java.lang.Object
- - java.util.concurrent.AbstractExecutorService
  - - java.util.concurrent.ThreadPoolExecutor
    - - org.apache.mina.filter.executor.OrderedThreadPoolExecutor

- All Implemented Interfaces:
    Executor, ExecutorService

      public class OrderedThreadPoolExecutor
      extends ThreadPoolExecutor

  A `ThreadPoolExecutor` that maintains the order of `IoEvent`s.

  If you don't need to maintain the order of events per session, please use `UnorderedThreadPoolExecutor`.

  Author:
    Apache MINA Project

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor

      `ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OrderedThreadPoolExecutor()` Creates a default ThreadPool, with default values : - minimum pool size is 0 - maximum pool size is 16 - keepAlive set to 30 seconds - A default ThreadFactory - All events are accepted
    `OrderedThreadPoolExecutor(int maximumPoolSize)` Creates a default ThreadPool, with default values : - minimum pool size is 0 - keepAlive set to 30 seconds - A default ThreadFactory - All events are accepted
    `OrderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize)` Creates a default ThreadPool, with default values : - keepAlive set to 30 seconds - A default ThreadFactory - All events are accepted
    `OrderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit)` Creates a default ThreadPool, with default values : - A default ThreadFactory - All events are accepted
    `OrderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, IoEventQueueHandler eventQueueHandler)` Creates a default ThreadPool, with default values : - A default ThreadFactory
    `OrderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory)` Creates a default ThreadPool, with default values : - A default ThreadFactory
    `OrderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory, IoEventQueueHandler eventQueueHandler)` Creates a new instance of a OrderedThreadPoolExecutor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `awaitTermination(long timeout, TimeUnit unit)`
    `void` | `execute(Runnable task)`
    `int` | `getActiveCount()`
    `long` | `getCompletedTaskCount()`
    `int` | `getCorePoolSize()`
    `int` | `getLargestPoolSize()`
    `int` | `getMaximumPoolSize()`
    `int` | `getPoolSize()`
    `BlockingQueue<Runnable>` | `getQueue()`
    `IoEventQueueHandler` | `getQueueHandler()`
    `long` | `getTaskCount()`
    `boolean` | `isShutdown()`
    `boolean` | `isTerminated()`
    `boolean` | `isTerminating()`
    `int` | `prestartAllCoreThreads()`
    `boolean` | `prestartCoreThread()`
    `void` | `purge()`
    `boolean` | `remove(Runnable task)`
    `void` | `setCorePoolSize(int corePoolSize)`
    `void` | `setMaximumPoolSize(int maximumPoolSize)`
    `void` | `setRejectedExecutionHandler(RejectedExecutionHandler handler)`
    `void` | `shutdown()`
    `List<Runnable>` | `shutdownNow()`

    - ### Methods inherited from class java.util.concurrent.ThreadPoolExecutor

      `afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, beforeExecute, finalize, getKeepAliveTime, getRejectedExecutionHandler, getThreadFactory, setKeepAliveTime, setThreadFactory, terminated, toString`

    - ### 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, wait, wait, wait`

- - ### Constructor Detail

    - #### OrderedThreadPoolExecutor

          public OrderedThreadPoolExecutor()

      Creates a default ThreadPool, with default values : - minimum pool size is 0 - maximum pool size is 16 - keepAlive set to 30 seconds - A default ThreadFactory - All events are accepted

    - #### OrderedThreadPoolExecutor

          public OrderedThreadPoolExecutor(int maximumPoolSize)

      Creates a default ThreadPool, with default values : - minimum pool size is 0 - keepAlive set to 30 seconds - A default ThreadFactory - All events are accepted
      Parameters:
        `maximumPoolSize` - The maximum pool size

    - #### OrderedThreadPoolExecutor

          public OrderedThreadPoolExecutor(int corePoolSize,
                                   int maximumPoolSize)

      Creates a default ThreadPool, with default values : - keepAlive set to 30 seconds - A default ThreadFactory - All events are accepted
      Parameters:
        `corePoolSize` - The initial pool sizePoolSize
        `maximumPoolSize` - The maximum pool size

    - #### OrderedThreadPoolExecutor

          public OrderedThreadPoolExecutor(int corePoolSize,
                                   int maximumPoolSize,
                                   long keepAliveTime,
                                   TimeUnit unit)

      Creates a default ThreadPool, with default values : - A default ThreadFactory - All events are accepted
      Parameters:
        `corePoolSize` - The initial pool sizePoolSize
        `maximumPoolSize` - The maximum pool size
        `keepAliveTime` - Default duration for a thread
        `unit` - Time unit used for the keepAlive value

    - #### OrderedThreadPoolExecutor

          public OrderedThreadPoolExecutor(int corePoolSize,
                                   int maximumPoolSize,
                                   long keepAliveTime,
                                   TimeUnit unit,
                                   IoEventQueueHandler eventQueueHandler)

      Creates a default ThreadPool, with default values : - A default ThreadFactory
      Parameters:
        `corePoolSize` - The initial pool sizePoolSize
        `maximumPoolSize` - The maximum pool size
        `keepAliveTime` - Default duration for a thread
        `unit` - Time unit used for the keepAlive value
        `eventQueueHandler` - The queue used to store events

    - #### OrderedThreadPoolExecutor

          public OrderedThreadPoolExecutor(int corePoolSize,
                                   int maximumPoolSize,
                                   long keepAliveTime,
                                   TimeUnit unit,
                                   ThreadFactory threadFactory)

      Creates a default ThreadPool, with default values : - A default ThreadFactory
      Parameters:
        `corePoolSize` - The initial pool sizePoolSize
        `maximumPoolSize` - The maximum pool size
        `keepAliveTime` - Default duration for a thread
        `unit` - Time unit used for the keepAlive value
        `threadFactory` - The factory used to create threads

    - #### OrderedThreadPoolExecutor

          public OrderedThreadPoolExecutor(int corePoolSize,
                                   int maximumPoolSize,
                                   long keepAliveTime,
                                   TimeUnit unit,
                                   ThreadFactory threadFactory,
                                   IoEventQueueHandler eventQueueHandler)

      Creates a new instance of a OrderedThreadPoolExecutor.
      Parameters:
        `corePoolSize` - The initial pool sizePoolSize
        `maximumPoolSize` - The maximum pool size
        `keepAliveTime` - Default duration for a thread
        `unit` - Time unit used for the keepAlive value
        `threadFactory` - The factory used to create threads
        `eventQueueHandler` - The queue used to store events

  - ### Method Detail

    - #### getQueueHandler

          public IoEventQueueHandler getQueueHandler()

      Returns:
        The associated queue handler.

    - #### setRejectedExecutionHandler

          public void setRejectedExecutionHandler(RejectedExecutionHandler handler)

      Overrides:
        `setRejectedExecutionHandler` in class `ThreadPoolExecutor`

    - #### getMaximumPoolSize

          public int getMaximumPoolSize()

      Overrides:
        `getMaximumPoolSize` in class `ThreadPoolExecutor`

    - #### setMaximumPoolSize

          public void setMaximumPoolSize(int maximumPoolSize)

      Overrides:
        `setMaximumPoolSize` in class `ThreadPoolExecutor`

    - #### awaitTermination

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

      Specified by:
        `awaitTermination` in interface `ExecutorService`
      Overrides:
        `awaitTermination` in class `ThreadPoolExecutor`
      Throws:
        `InterruptedException`

    - #### isShutdown

          public boolean isShutdown()

      Specified by:
        `isShutdown` in interface `ExecutorService`
      Overrides:
        `isShutdown` in class `ThreadPoolExecutor`

    - #### isTerminated

          public boolean isTerminated()

      Specified by:
        `isTerminated` in interface `ExecutorService`
      Overrides:
        `isTerminated` in class `ThreadPoolExecutor`

    - #### shutdown

          public void shutdown()

      Specified by:
        `shutdown` in interface `ExecutorService`
      Overrides:
        `shutdown` in class `ThreadPoolExecutor`

    - #### shutdownNow

          public List<Runnable> shutdownNow()

      Specified by:
        `shutdownNow` in interface `ExecutorService`
      Overrides:
        `shutdownNow` in class `ThreadPoolExecutor`

    - #### execute

          public void execute(Runnable task)

      Specified by:
        `execute` in interface `Executor`
      Overrides:
        `execute` in class `ThreadPoolExecutor`

    - #### getActiveCount

          public int getActiveCount()

      Overrides:
        `getActiveCount` in class `ThreadPoolExecutor`

    - #### getCompletedTaskCount

          public long getCompletedTaskCount()

      Overrides:
        `getCompletedTaskCount` in class `ThreadPoolExecutor`

    - #### getLargestPoolSize

          public int getLargestPoolSize()

      Overrides:
        `getLargestPoolSize` in class `ThreadPoolExecutor`

    - #### getPoolSize

          public int getPoolSize()

      Overrides:
        `getPoolSize` in class `ThreadPoolExecutor`

    - #### getTaskCount

          public long getTaskCount()

      Overrides:
        `getTaskCount` in class `ThreadPoolExecutor`

    - #### isTerminating

          public boolean isTerminating()

      Overrides:
        `isTerminating` in class `ThreadPoolExecutor`

    - #### prestartAllCoreThreads

          public int prestartAllCoreThreads()

      Overrides:
        `prestartAllCoreThreads` in class `ThreadPoolExecutor`

    - #### prestartCoreThread

          public boolean prestartCoreThread()

      Overrides:
        `prestartCoreThread` in class `ThreadPoolExecutor`

    - #### getQueue

          public BlockingQueue<Runnable> getQueue()

      Overrides:
        `getQueue` in class `ThreadPoolExecutor`

    - #### purge

          public void purge()

      Overrides:
        `purge` in class `ThreadPoolExecutor`

    - #### remove

          public boolean remove(Runnable task)

      Overrides:
        `remove` in class `ThreadPoolExecutor`

    - #### getCorePoolSize

          public int getCorePoolSize()

      Overrides:
        `getCorePoolSize` in class `ThreadPoolExecutor`

    - #### setCorePoolSize

          public void setCorePoolSize(int corePoolSize)

      Overrides:
        `setCorePoolSize` in class `ThreadPoolExecutor`

Copyright © 2004-2012 Apache MINA Project. All Rights Reserved.