com.sun.grizzly
Interface Pipeline<E>

All Known Implementing Classes:
DefaultPipeline, LinkedListPipeline

public interface Pipeline<E>

An interface used as a wrapper around any kind of thread pool.

Author:
Jean-Francois Arcand

Method Summary
 void execute(E task)
          Add an E to be processed by this Pipeline
 boolean expireKey(SelectionKey key)
          Invoked when the SelectorThread is about to expire a SelectionKey.
 int getCurrentThreadCount()
          Return the number of active threads.
 int getCurrentThreadsBusy()
          Return the curent number of threads that are currently processing a task.
 int getMaxThreads()
          Return the number of threads used by this pipeline.
 String getName()
          Return the name of this Pipeline
 int getWaitingThread()
          Return the number of waiting threads.
 void initPipeline()
          Init the Pipeline by initializing the required WorkerThread.
 void setMaxThreads(int maxThread)
          Set the maximum thread this pipeline can handle.
 void setMinThreads(int minThread)
          Set the minimum thread this pipeline can handle.
 void setName(String name)
          Set the name of this Pipeline
 void setPort(int port)
          Set the port this Pipeline is associated with.
 void setPriority(int priority)
          Set the Thread priority used when creating new threads.
 void setQueueSizeInBytes(int maxQueueSizeInBytesCount)
          Set the maximum pending connection this Pipeline can handle.
 void setThreadsIncrement(int processorThreadsIncrement)
          Set the number the Pipeline will use when increasing the thread pool
 int size()
          Returns the number of tasks in this Pipeline.
 void startPipeline()
          Start the Pipeline
 void stopPipeline()
          Stop the Pipeline
 E waitForIoTask()
          Return a E object available in the pipeline.
 

Method Detail

expireKey

boolean expireKey(SelectionKey key)
Invoked when the SelectorThread is about to expire a SelectionKey.

Parameters:
key - SelectionKey
Returns:
true if the SelectorThread should expire the SelectionKey, false if not.

execute

void execute(E task)
             throws PipelineFullException
Add an E to be processed by this Pipeline

Parameters:
task -
Throws:
PipelineFullException

waitForIoTask

E waitForIoTask()
Return a E object available in the pipeline.

Returns:

getWaitingThread

int getWaitingThread()
Return the number of waiting threads.

Returns:
number of waiting threads

getMaxThreads

int getMaxThreads()
Return the number of threads used by this pipeline.

Returns:
max number of threads

getCurrentThreadCount

int getCurrentThreadCount()
Return the number of active threads.

Returns:
number of active threads

getCurrentThreadsBusy

int getCurrentThreadsBusy()
Return the curent number of threads that are currently processing a task.

Returns:
number of currently processing threads

initPipeline

void initPipeline()
Init the Pipeline by initializing the required WorkerThread. Default value is 10


getName

String getName()
Return the name of this Pipeline

Returns:
name of this Pipeline

startPipeline

void startPipeline()
Start the Pipeline


stopPipeline

void stopPipeline()
Stop the Pipeline


setPriority

void setPriority(int priority)
Set the Thread priority used when creating new threads.

Parameters:
priority -

setMaxThreads

void setMaxThreads(int maxThread)
Set the maximum thread this pipeline can handle.

Parameters:
maxThread -

setMinThreads

void setMinThreads(int minThread)
Set the minimum thread this pipeline can handle.

Parameters:
minThread -

setPort

void setPort(int port)
Set the port this Pipeline is associated with.

Parameters:
port -

setName

void setName(String name)
Set the name of this Pipeline

Parameters:
name -

setQueueSizeInBytes

void setQueueSizeInBytes(int maxQueueSizeInBytesCount)
Set the maximum pending connection this Pipeline can handle.

Parameters:
maxQueueSizeInBytesCount -

setThreadsIncrement

void setThreadsIncrement(int processorThreadsIncrement)
Set the number the Pipeline will use when increasing the thread pool

Parameters:
processorThreadsIncrement -

size

int size()
Returns the number of tasks in this Pipeline.

Returns:
Number of tasks in this Pipeline.


Copyright © 2010 SUN Microsystems. All Rights Reserved.