Package org.apache.mina.management
Class MINAStatCollector
- java.lang.Object
-
- org.apache.mina.management.MINAStatCollector
-
public class MINAStatCollector extends Object
Collects statistics of anIoService. It's polling all the sessions of a given IoService. It's attaching aMINAStatCollector.IoSessionStatobject to all the sessions polled and filling the throughput values. Usage :IoService service = ... MINAStatCollector collector = new MINAStatCollector( service ); collector.start();
By default theMINAStatCollectoris polling the sessions every 5 seconds. You can give a different polling time using a second constructor.Note: This class is a spin-off from StatCollector present in https://svn.apache.org/repos/asf/mina/branches/1.1/core/src/main/java/org/apache/mina/management.
- Author:
- The Apache Directory Project (mina-dev@directory.apache.org)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classMINAStatCollector.IoSessionStat
-
Field Summary
Fields Modifier and Type Field Description static StringKEYThe session attribute key forMINAStatCollector.IoSessionStat.
-
Constructor Summary
Constructors Constructor Description MINAStatCollector(org.apache.mina.core.service.IoService service)Create a stat collector for the given service with a default polling time of 5 seconds.MINAStatCollector(org.apache.mina.core.service.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 longgetBytesRead()longgetBytesWritten()longgetMsgRead()longgetMsgWritten()longgetQueuedEvents()longgetScheduledWrites()longgetSessionCount()longgetTotalProcessedSessions()total number of sessions processed by the stat collectorbooleanisRunning()is the stat collector started and polling theIoSessionof theIoServicevoidstart()Start collecting stats for theIoSessionof the service.voidstop()Stop collecting stats.
-
-
-
Field Detail
-
KEY
public static final String KEY
The session attribute key forMINAStatCollector.IoSessionStat.
-
-
Constructor Detail
-
MINAStatCollector
public MINAStatCollector(org.apache.mina.core.service.IoService service)
Create a stat collector for the given service with a default polling time of 5 seconds.- Parameters:
service- the IoService to inspect
-
MINAStatCollector
public MINAStatCollector(org.apache.mina.core.service.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 theMINAStatCollector.IoSessionStatobject will be removed of the polled session attachements.
-
isRunning
public boolean isRunning()
is the stat collector started and polling theIoSessionof theIoService- Returns:
- true if started
-
getTotalProcessedSessions
public long getTotalProcessedSessions()
total number of sessions processed by the stat collector- Returns:
- number of sessions
-
getBytesRead
public long getBytesRead()
-
getBytesWritten
public long getBytesWritten()
-
getMsgRead
public long getMsgRead()
-
getMsgWritten
public long getMsgWritten()
-
getScheduledWrites
public long getScheduledWrites()
-
getQueuedEvents
public long getQueuedEvents()
-
getSessionCount
public long getSessionCount()
-
-