public class StatCollector
extends java.lang.Object
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.Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
KEY |
The session attribute key for
IoSessionStat . |
Constructor | Description |
---|---|
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
|
Modifier and Type | Method | Description |
---|---|---|
float |
getBytesReadThroughput() |
|
float |
getBytesWrittenThroughput() |
|
float |
getMsgReadThroughput() |
|
float |
getMsgWrittenThroughput() |
|
long |
getSessionCount() |
|
long |
getTotalProcessedSessions() |
total number of sessions processed by the stat collector
|
boolean |
isRunning() |
|
void |
start() |
Start collecting stats for the
IoSession of the service. |
void |
stop() |
Stop collecting stats.
|
public static final java.lang.String KEY
IoSessionStat
.public StatCollector(IoService service)
service
- the IoService to inspectpublic StatCollector(IoService service, int pollingInterval)
service
- the IoService to inspectpollingInterval
- millisecondspublic void start()
IoSession
of the service.
New sessions or destroyed will be automaticly added or removed.public void stop()
IoSessionStat
object will be removed of the
polled session attachements.public boolean isRunning()
public long getTotalProcessedSessions()
public float getBytesReadThroughput()
public float getBytesWrittenThroughput()
public float getMsgReadThroughput()
public float getMsgWrittenThroughput()
public long getSessionCount()