Package org.apache.mina.management
Class StatCollector
- java.lang.Object
-
- org.apache.mina.management.StatCollector
-
public class StatCollector extends java.lang.ObjectCollects statistics of anIoService. It's polling all the sessions of a given IoService. It's attaching aIoSessionStatobject to all the sessions polled and filling the throughput values. Usage :IoService service = ... StatCollector collector = new StatCollector( service ); collector.start();
By default theStatCollectoris polling the sessions every 5 seconds. You can give a different polling time using a second constructor.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringKEYThe session attribute key forIoSessionStat.
-
Constructor Summary
Constructors 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
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description floatgetBytesReadThroughput()floatgetBytesWrittenThroughput()floatgetMsgReadThroughput()floatgetMsgWrittenThroughput()longgetSessionCount()longgetTotalProcessedSessions()total number of sessions processed by the stat collectorbooleanisRunning()voidstart()Start collecting stats for theIoSessionof the service.voidstop()Stop collecting stats.
-
-
-
Field Detail
-
KEY
public static final java.lang.String KEY
The session attribute key forIoSessionStat.
-
-
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 inspectpollingInterval- milliseconds
-
-
Method Detail
-
start
public void start()
Start collecting stats for theIoSessionof the service. New sessions or destroyed will be automaticly added or removed.
-
stop
public void stop()
Stop collecting stats. all theIoSessionStatobject will be removed of the polled session attachements.
-
isRunning
public boolean isRunning()
- 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()
-
-