com.sun.grizzly.http
Class StatsThreadPool

java.lang.Object
  extended by java.util.concurrent.AbstractExecutorService
      extended by com.sun.grizzly.util.GrizzlyExecutorService
          extended by com.sun.grizzly.http.StatsThreadPool
All Implemented Interfaces:
ExtendedThreadPool, Executor, ExecutorService

public class StatsThreadPool
extends GrizzlyExecutorService

Internal FIFO used by the Worker Threads to pass information between Task objects.

Author:
Jean-Francois Arcand

Nested Class Summary
protected static class StatsThreadPool.HttpWorkerThreadFactory
          Create new HttpWorkerThread.
 
Field Summary
static int DEFAULT_IDLE_THREAD_KEEPALIVE_TIMEOUT
           
static int DEFAULT_MAX_TASKS_QUEUED
           
static int DEFAULT_MAX_THREAD_COUNT
           
static int DEFAULT_MIN_THREAD_COUNT
           
protected  int port
          Port, which is served by this thread pool
protected  ThreadPoolStatistic threadPoolStat
           
 
Fields inherited from class com.sun.grizzly.util.GrizzlyExecutorService
config
 
Constructor Summary
StatsThreadPool()
           
StatsThreadPool(int maxTasksCount)
           
StatsThreadPool(int corePoolSize, int maximumPoolSize, int maxTasksCount, long keepAliveTime, TimeUnit unit)
           
StatsThreadPool(String name, int corePoolSize, int maximumPoolSize, int maxTasksCount, long keepAliveTime, TimeUnit unit)
           
StatsThreadPool(ThreadPoolConfig config)
           
 
Method Summary
 boolean awaitTermination(long timeout, TimeUnit unit)
           
 void execute(Runnable r)
           
 int getActiveCount()
           
 long getCompletedTaskCount()
           
 int getLargestPoolSize()
           
 int getPoolSize()
           
 int getPort()
          Get the port number, which is served by the thread pool
 int getQueueSize()
           
 ThreadPoolStatistic getStatistic()
          Return the ThreadPoolStatistic object used to gather statistic;
 int getTaskCount()
           
protected  void injectToStringAttributes(StringBuilder sb)
          Deprecated.  
 boolean isShutdown()
           
 boolean isTerminated()
           
 GrizzlyExecutorService reconfigure(ThreadPoolConfig config)
           
 void setPort(int port)
          Set the port number, which is served by the thread pool
 void setStatistic(ThreadPoolStatistic threadPoolStatistic)
          Set the ThreadPoolStatistic object used to gather statistic;
 void shutdown()
           
 List<Runnable> shutdownNow()
           
 void start()
           
 void stop()
           
 String toString()
           
 
Methods inherited from class com.sun.grizzly.util.GrizzlyExecutorService
createInstance, createInstance, getConfiguration, getCorePoolSize, getKeepAliveTime, getMaximumPoolSize, getMaxQueuedTasksCount, getName, getPriority, getQueue, getThreadFactory, setCorePoolSize, setImpl, setKeepAliveTime, setMaximumPoolSize, setMaxQueuedTasksCount, setName, setPriority, setThreadFactory
 
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.concurrent.ExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submit
 

Field Detail

DEFAULT_MIN_THREAD_COUNT

public static int DEFAULT_MIN_THREAD_COUNT

DEFAULT_MAX_THREAD_COUNT

public static int DEFAULT_MAX_THREAD_COUNT

DEFAULT_MAX_TASKS_QUEUED

public static int DEFAULT_MAX_TASKS_QUEUED

DEFAULT_IDLE_THREAD_KEEPALIVE_TIMEOUT

public static int DEFAULT_IDLE_THREAD_KEEPALIVE_TIMEOUT

port

protected int port
Port, which is served by this thread pool


threadPoolStat

protected transient ThreadPoolStatistic threadPoolStat
Constructor Detail

StatsThreadPool

public StatsThreadPool()

StatsThreadPool

public StatsThreadPool(int maxTasksCount)

StatsThreadPool

public StatsThreadPool(int corePoolSize,
                       int maximumPoolSize,
                       int maxTasksCount,
                       long keepAliveTime,
                       TimeUnit unit)

StatsThreadPool

public StatsThreadPool(String name,
                       int corePoolSize,
                       int maximumPoolSize,
                       int maxTasksCount,
                       long keepAliveTime,
                       TimeUnit unit)

StatsThreadPool

public StatsThreadPool(ThreadPoolConfig config)
Method Detail

start

public void start()

stop

public void stop()

execute

public final void execute(Runnable r)
Specified by:
execute in interface Executor
Overrides:
execute in class GrizzlyExecutorService

shutdown

public void shutdown()
Specified by:
shutdown in interface ExecutorService
Overrides:
shutdown in class GrizzlyExecutorService

shutdownNow

public List<Runnable> shutdownNow()
Specified by:
shutdownNow in interface ExecutorService
Overrides:
shutdownNow in class GrizzlyExecutorService

getPort

public int getPort()
Get the port number, which is served by the thread pool

Returns:
the port number, which is served by the thread pool

setPort

public void setPort(int port)
Set the port number, which is served by the thread pool

Parameters:
port - the port number, which is served by the thread pool

setStatistic

public void setStatistic(ThreadPoolStatistic threadPoolStatistic)
Set the ThreadPoolStatistic object used to gather statistic;


getStatistic

public ThreadPoolStatistic getStatistic()
Return the ThreadPoolStatistic object used to gather statistic;


reconfigure

public GrizzlyExecutorService reconfigure(ThreadPoolConfig config)
Overrides:
reconfigure in class GrizzlyExecutorService

getLargestPoolSize

public int getLargestPoolSize()
Specified by:
getLargestPoolSize in interface ExtendedThreadPool
Overrides:
getLargestPoolSize in class GrizzlyExecutorService

getPoolSize

public int getPoolSize()
Specified by:
getPoolSize in interface ExtendedThreadPool
Overrides:
getPoolSize in class GrizzlyExecutorService

getQueueSize

public int getQueueSize()
Specified by:
getQueueSize in interface ExtendedThreadPool
Overrides:
getQueueSize in class GrizzlyExecutorService

getActiveCount

public int getActiveCount()
Specified by:
getActiveCount in interface ExtendedThreadPool
Overrides:
getActiveCount in class GrizzlyExecutorService

getTaskCount

public int getTaskCount()
Specified by:
getTaskCount in interface ExtendedThreadPool
Overrides:
getTaskCount in class GrizzlyExecutorService

getCompletedTaskCount

public long getCompletedTaskCount()
Specified by:
getCompletedTaskCount in interface ExtendedThreadPool
Overrides:
getCompletedTaskCount in class GrizzlyExecutorService

isShutdown

public boolean isShutdown()
Specified by:
isShutdown in interface ExecutorService
Overrides:
isShutdown in class GrizzlyExecutorService

isTerminated

public boolean isTerminated()
Specified by:
isTerminated in interface ExecutorService
Overrides:
isTerminated in class GrizzlyExecutorService

awaitTermination

public boolean awaitTermination(long timeout,
                                TimeUnit unit)
                         throws InterruptedException
Specified by:
awaitTermination in interface ExecutorService
Overrides:
awaitTermination in class GrizzlyExecutorService
Throws:
InterruptedException

toString

public String toString()
Overrides:
toString in class Object

injectToStringAttributes

protected void injectToStringAttributes(StringBuilder sb)
Deprecated. 

Inject toString() to a specific StringBuilder

Parameters:
sb -


Copyright © 2010 Oracle Corpration. All Rights Reserved.