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.IoSessionStat
object to all the sessions polled and filling the throughput values. Usage :IoService service = ... MINAStatCollector collector = new MINAStatCollector( service ); collector.start();
By default theMINAStatCollector
is 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 class
MINAStatCollector.IoSessionStat
-
Field Summary
Fields Modifier and Type Field Description static String
KEY
The 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 long
getBytesRead()
long
getBytesWritten()
long
getMsgRead()
long
getMsgWritten()
long
getQueuedEvents()
long
getScheduledWrites()
long
getSessionCount()
long
getTotalProcessedSessions()
total number of sessions processed by the stat collectorboolean
isRunning()
is the stat collector started and polling theIoSession
of theIoService
void
start()
Start collecting stats for theIoSession
of the service.void
stop()
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 theIoSession
of the service. New sessions or destroyed will be automaticly added or removed.
-
stop
public void stop()
Stop collecting stats. all theMINAStatCollector.IoSessionStat
object will be removed of the polled session attachements.
-
isRunning
public boolean isRunning()
is the stat collector started and polling theIoSession
of 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()
-
-