Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.mina.management
Class StatCollector

    java.lang.Object
      org.apache.mina.management.StatCollector

    public class StatCollector

extends Object

Collects statistics of an `IoService`. It's polling all the sessions of a given IoService. It's attaching a `IoSessionStat` object to all the sessions polled and filling the throughput values. Usage :

     IoService service = ...
     StatCollector collector = new StatCollector( service );
     collector.start();

By default the `StatCollector` is polling the sessions every 5 seconds. You can give a different polling time using a second constructor.

Version:
  $Rev: 555855 $, $Date: 2007-07-13 12:19:00 +0900 (Fri, 13 Jul 2007) $
Author:
  The Apache Directory Project (mina-dev@directory.apache.org)

Field Summary
`static String` | `KEY` The session attribute key for `IoSessionStat`.

Constructor Summary
`StatCollector(IoService service)` Create a stat collector for the given service with a default polling time of 5 seconds.
`StatCollector(IoService service, int pollingInterval)` create a stat collector for the given given service

Method Summary
`float` | `getBytesReadThroughput()`
`float` | `getBytesWrittenThroughput()`
`float` | `getMsgReadThroughput()`
`float` | `getMsgWrittenThroughput()`
`long` | `getSessionCount()`
`long` | `getTotalProcessedSessions()` total number of sessions processed by the stat collector
`boolean` | `isRunning()` is the stat collector started and polling the `IoSession` of the `IoService`
`void` | `start()` Start collecting stats for the `IoSession` of the service.
`void` | `stop()` Stop collecting stats. all the `IoSessionStat` object will be removed of the polled session attachements.

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

Field Detail

### KEY

    public static final String KEY

  The session attribute key for `IoSessionStat`.

Constructor Detail

### StatCollector

    public StatCollector(IoService service)

  Create a stat collector for the given service with a default polling time of 5 seconds.

  Parameters:
    `service` - the IoService to inspect

### StatCollector

    public StatCollector(IoService service,
                         int pollingInterval)

  create a stat collector for the given given service

  Parameters:
    `service` - the IoService to inspect
    `pollingInterval` - milliseconds

Method Detail

### start

    public void start()

  Start collecting stats for the `IoSession` of the service. New sessions or destroyed will be automaticly added or removed.

### stop

    public void stop()

  Stop collecting stats. all the `IoSessionStat` object will be removed of the polled session attachements.

### isRunning

    public boolean isRunning()

  is the stat collector started and polling the `IoSession` of the `IoService`

  Returns:
    true if started

### getTotalProcessedSessions

    public long getTotalProcessedSessions()

  total number of sessions processed by the stat collector

  Returns:
    number of sessions

### getBytesReadThroughput

    public float getBytesReadThroughput()

### getBytesWrittenThroughput

    public float getBytesWrittenThroughput()

### getMsgReadThroughput

    public float getMsgReadThroughput()

### getMsgWrittenThroughput

    public float getMsgWrittenThroughput()

### getSessionCount

    public long getSessionCount()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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