## com.sun.grizzly
Class ExecutorServicePipeline

    java.lang.Object
      com.sun.grizzly.ExecutorServicePipeline

All Implemented Interfaces:
  Pipeline

    public class ExecutorServicePipeline

extends Object
implements Pipeline

A wrapper around an `ThreadPoolExecutor`.

Author:
  Jean-Francois Arcand

Constructor Summary
`ExecutorServicePipeline()`

Method Summary
`void` `addTask(com.sun.jmx.snmp.tasks.Task task)` Add an object to this pipeline
`int` `getCurrentThreadCount()` Return the current number of threads used.
`int` `getCurrentThreadsBusy()` Return the curent number of threads that are currently processing a task.
`int` `getMaxSpareThreads()` Return the maximum spare thread.
`int` `getMaxThreads()` Return the number of threads used by this pipeline.
`int` `getMinSpareThreads()` Return the minimum spare thread.
`String` `getName()` Return the name of this `Pipeline`
`PipelineStatistic` `getPipelineStatistic()` Return the `PipelineStatistic` object used to gather statistic;
`int` `getQueueSizeInBytes()` Get the maximum pending connection this `Pipeline` can handle.
`com.sun.jmx.snmp.tasks.Task` `getTask()` Return a `Task` object available in the pipeline.
`int` `getWaitingThread()` Return the number of waiting threads.
`void` `initPipeline()` Init the `Pipeline` by initializing the required `ThreadPoolExecutor`.
`boolean` `interruptThread(long threadID)` Interrupt the `Thread` using it thread id
`void` `setMaxThreads(int maxThreads)` Set the number of threads used by this pipeline.
`void` `setMinSpareThreads(int minSpareThreads)` Set the minimum space thread this `Pipeline` can handle.
`void` `setMinThreads(int minThreads)` Set the minimum thread this `Pipeline` will creates when initializing.
`void` `setName(String name)` Set the name of this `Pipeline`
`void` `setPipelineStatistic(PipelineStatistic pipelineStatistic)` Set the `PipelineStatistic` object used to gather statistic;
`void` `setPort(int port)` Set the port used by this `Pipeline`
`void` `setPriority(int priority)` Set the thread priority of the `Pipeline`
`void` `setQueueSizeInBytes(int maxQueueSizeInBytes)` Set the maximum pending connection this `Pipeline` can handle.
`void` `setThreadsIncrement(int threadsIncrement)` Set the number the `Pipeline` will use when increasing the thread pool
`void` `setThreadsTimeout(int threadsTimeout)`
`int` `size()` Returns the number of tasks in this `Pipeline`.
`void` `startPipeline()` Start the `Pipeline`
`void` `stopPipeline()` Stop the `Pipeline`
`String` `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.sun.grizzly.Pipeline
`execute, setMaxQueueSize, waitForIoTask`

Constructor Detail

### ExecutorServicePipeline

    public ExecutorServicePipeline()

Method Detail

### initPipeline

    public void initPipeline()

  Init the `Pipeline` by initializing the required `ThreadPoolExecutor`.

  Specified by:
    `initPipeline` in interface `Pipeline`

### startPipeline

    public void startPipeline()

  Start the `Pipeline`

  Specified by:
    `startPipeline` in interface `Pipeline`

### stopPipeline

    public void stopPipeline()

  Stop the `Pipeline`

  Specified by:
    `stopPipeline` in interface `Pipeline`

### interruptThread

    public boolean interruptThread(long threadID)

  Interrupt the `Thread` using it thread id

### addTask

    public void addTask(com.sun.jmx.snmp.tasks.Task task)

  Add an object to this pipeline

### getTask

    public com.sun.jmx.snmp.tasks.Task getTask()

  Return a `Task` object available in the pipeline.

### size

    public int size()

  Returns the number of tasks in this `Pipeline`.

  Specified by:
    `size` in interface `Pipeline`
  Returns:
    Number of tasks in this `Pipeline`.

### getWaitingThread

    public int getWaitingThread()

  Return the number of waiting threads.

  Specified by:
    `getWaitingThread` in interface `Pipeline`
  Returns:
    number of waiting threads

### setMaxThreads

    public void setMaxThreads(int maxThreads)

  Set the number of threads used by this pipeline.

  Specified by:
    `setMaxThreads` in interface `Pipeline`

### getMaxThreads

    public int getMaxThreads()

  Return the number of threads used by this pipeline.

  Specified by:
    `getMaxThreads` in interface `Pipeline`
  Returns:
    max number of threads

### getCurrentThreadCount

    public int getCurrentThreadCount()

  Return the current number of threads used.

  Specified by:
    `getCurrentThreadCount` in interface `Pipeline`
  Returns:
    number of active threads

### getCurrentThreadsBusy

    public int getCurrentThreadsBusy()

  Return the curent number of threads that are currently processing a task.

  Specified by:
    `getCurrentThreadsBusy` in interface `Pipeline`
  Returns:
    number of currently processing threads

### getMaxSpareThreads

    public int getMaxSpareThreads()

  Return the maximum spare thread.

### getMinSpareThreads

    public int getMinSpareThreads()

  Return the minimum spare thread.

### setMinSpareThreads

    public void setMinSpareThreads(int minSpareThreads)

  Set the minimum space thread this `Pipeline` can handle.

### setPriority

    public void setPriority(int priority)

  Set the thread priority of the `Pipeline`

  Specified by:
    `setPriority` in interface `Pipeline`

### setName

    public void setName(String name)

  Set the name of this `Pipeline`

  Specified by:
    `setName` in interface `Pipeline`

### getName

    public String getName()

  Return the name of this `Pipeline`

  Specified by:
    `getName` in interface `Pipeline`
  Returns:
    the name of this `Pipeline`

### setPort

    public void setPort(int port)

  Set the port used by this `Pipeline`

  Parameters:
    `port` - the port used by this `Pipeline`

### setMinThreads

    public void setMinThreads(int minThreads)

  Set the minimum thread this `Pipeline` will creates when initializing.

  Specified by:
    `setMinThreads` in interface `Pipeline`
  Parameters:
    `minThreads` - the minimum number of threads.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### setQueueSizeInBytes

    public void setQueueSizeInBytes(int maxQueueSizeInBytes)

  Set the maximum pending connection this `Pipeline` can handle.

### getQueueSizeInBytes

    public int getQueueSizeInBytes()

  Get the maximum pending connection this `Pipeline` can handle.

### setThreadsIncrement

    public void setThreadsIncrement(int threadsIncrement)

  Description copied from interface: `Pipeline`
  Set the number the `Pipeline` will use when increasing the thread pool

  Specified by:
    `setThreadsIncrement` in interface `Pipeline`

### setThreadsTimeout

    public void setThreadsTimeout(int threadsTimeout)

### setPipelineStatistic

    public void setPipelineStatistic(PipelineStatistic pipelineStatistic)

  Set the `PipelineStatistic` object used to gather statistic;

### getPipelineStatistic

    public PipelineStatistic getPipelineStatistic()

  Return the `PipelineStatistic` object used to gather statistic;

Copyright © 2008 SUN Microsystems. All Rights Reserved.