com.sun.grizzly.http
Class ThreadPoolStatistic

java.lang.Object
  extended by com.sun.grizzly.http.ThreadPoolStatistic

public class ThreadPoolStatistic
extends Object

This class is a placeholde for gathering statistic from a ExecutorService

Author:
Jean-Francois Arcand

Constructor Summary
ThreadPoolStatistic(int port)
          Constructor
 
Method Summary
 boolean decrementOpenConnectionsCount(SelectableChannel channel)
          Decrease the number of open connections, which are being handled by the Pipeline
 boolean gather(int queueLength)
          Gather ExecutorService statistic.
 int getCountOverflows()
          Total number of thread pool overflow
 int getCountQueued()
          Gets the number of connections currently in the queue
 int getCountQueued15MinuteAverage()
          Gets the average number of connections queued in the last 15 minutes
 int getCountQueued1MinuteAverage()
          Gets the average number of connections queued in the last 1 minute
 int getCountQueued5MinuteAverage()
          Gets the average number of connections queued in the last 5 minutes
 int getCountTotalConnections()
          Gets the total number of connections that have been accepted.
 int getCountTotalQueued()
          Gets the total number of connections that have been queued.
 int getMaxQueued()
          Gets the maximum size of the connection queue
 int getOpenConnectionsCount()
          Get the current number of open channels, which are being handled by the pipeline
 int getPeakQueued()
          Gets the largest number of connections that were in the queue simultaneously.
 int getQueueSizeInBytes()
          Get the maximum pending connection this ExecutorService can handle.
 int getTicksTotalQueued()
          Gets the total number of ticks that connections have spent in the queue.
 boolean incrementOpenConnectionsCount(SelectableChannel channel)
          Increase the number of open connections, which are being handled by the Pipeline
 void incrementTotalAcceptCount()
           
 void setQueueSizeInBytes(int maxQueueSizeInBytesCount)
          Set the maximum pending connection this ExecutorService can handle.
 void setThreadPool(ExecutorService threadPool)
           
 void start()
          Start gathering statistics.
 void stop()
          Stop gathering statistics.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadPoolStatistic

public ThreadPoolStatistic(int port)
Constructor

Parameters:
port - Port number for which thread pool (connection) stats will be gathered
Method Detail

start

public void start()
Start gathering statistics.


stop

public void stop()
Stop gathering statistics.


gather

public boolean gather(int queueLength)
Gather ExecutorService statistic.


getCountOverflows

public int getCountOverflows()
Total number of thread pool overflow


getPeakQueued

public int getPeakQueued()
Gets the largest number of connections that were in the queue simultaneously.

Returns:
Largest number of connections that were in the queue simultaneously

getMaxQueued

public int getMaxQueued()
Gets the maximum size of the connection queue

Returns:
Maximum size of the connection queue

getCountTotalConnections

public int getCountTotalConnections()
Gets the total number of connections that have been accepted.

Returns:
Total number of connections that have been accepted.

setQueueSizeInBytes

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


getQueueSizeInBytes

public int getQueueSizeInBytes()
Get the maximum pending connection this ExecutorService can handle.


getCountTotalQueued

public int getCountTotalQueued()
Gets the total number of connections that have been queued. A given connection may be queued multiple times, so counttotalqueued may be greater than or equal to counttotalconnections.

Returns:
Total number of connections that have been queued

getCountQueued

public int getCountQueued()
Gets the number of connections currently in the queue

Returns:
Number of connections currently in the queue

getTicksTotalQueued

public int getTicksTotalQueued()
Gets the total number of ticks that connections have spent in the queue. A tick is a system-dependent unit of time.

Returns:
Total number of ticks that connections have spent in the queue

getCountQueued1MinuteAverage

public int getCountQueued1MinuteAverage()
Gets the average number of connections queued in the last 1 minute

Returns:
Average number of connections queued in the last 1 minute

getCountQueued5MinuteAverage

public int getCountQueued5MinuteAverage()
Gets the average number of connections queued in the last 5 minutes

Returns:
Average number of connections queued in the last 5 minutes

getCountQueued15MinuteAverage

public int getCountQueued15MinuteAverage()
Gets the average number of connections queued in the last 15 minutes

Returns:
Average number of connections queued in the last 15 minutes

incrementTotalAcceptCount

public void incrementTotalAcceptCount()

setThreadPool

public void setThreadPool(ExecutorService threadPool)

incrementOpenConnectionsCount

public boolean incrementOpenConnectionsCount(SelectableChannel channel)
Increase the number of open connections, which are being handled by the Pipeline

Parameters:
channel - just open channel
Returns:
true, if channel was added, false if channel was already counted in the statistics

decrementOpenConnectionsCount

public boolean decrementOpenConnectionsCount(SelectableChannel channel)
Decrease the number of open connections, which are being handled by the Pipeline

Parameters:
channel - just closed channel
Returns:
true, if channel was removed from statics of open channels, false if channel is not in the statistics (probably removed from statics earlier)

getOpenConnectionsCount

public int getOpenConnectionsCount()
Get the current number of open channels, which are being handled by the pipeline

Returns:
the current number of open channels, which are being handled by the pipeline


Copyright © 2012 Oracle Corporation. All Rights Reserved.