Package org.apache.mina.core.service
Class IoServiceStatistics
- java.lang.Object
-
- org.apache.mina.core.service.IoServiceStatistics
-
public class IoServiceStatistics extends Object
Provides usage statistics for anAbstractIoService
instance.- Since:
- 2.0.0-M3
- Author:
- Apache MINA Project
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IoServiceStatistics.Config
This is a configuration for IoServiceStatistics.
-
Constructor Summary
Constructors Constructor Description IoServiceStatistics(IoService service)
Creates a new IoServiceStatistics instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
decreaseScheduledWriteMessages()
Decrements the count of messages scheduled for write.IoServiceStatistics.Config
getConfig()
long
getCumulativeManagedSessionCount()
int
getLargestManagedSessionCount()
double
getLargestReadBytesThroughput()
double
getLargestReadMessagesThroughput()
double
getLargestWrittenBytesThroughput()
double
getLargestWrittenMessagesThroughput()
long
getLastIoTime()
long
getLastReadTime()
long
getLastWriteTime()
long
getReadBytes()
double
getReadBytesThroughput()
long
getReadMessages()
double
getReadMessagesThroughput()
int
getScheduledWriteBytes()
int
getScheduledWriteMessages()
int
getThroughputCalculationInterval()
long
getThroughputCalculationIntervalInMillis()
long
getWrittenBytes()
double
getWrittenBytesThroughput()
long
getWrittenMessages()
double
getWrittenMessagesThroughput()
void
increaseReadBytes(long nbBytesRead, long currentTime)
Increases the count of read bytes bynbBytesRead
and sets the last read time tocurrentTime
.void
increaseReadMessages(long currentTime)
Increases the count of read messages by 1 and sets the last read time tocurrentTime
.void
increaseScheduledWriteBytes(int increment)
Increments byincrement
the count of bytes scheduled for write.void
increaseScheduledWriteMessages()
Increments the count of messages scheduled for write.void
increaseWrittenBytes(int nbBytesWritten, long currentTime)
Increases the count of written bytes bynbBytesWritten
and sets the last write time tocurrentTime
.void
increaseWrittenMessages(long currentTime)
Increases the count of written messages by 1 and sets the last write time tocurrentTime
.protected void
setLastReadTime(long lastReadTime)
Sets last time at which a read occurred on the service.protected void
setLastThroughputCalculationTime(long lastThroughputCalculationTime)
Sets the time at which throughput counters where updated.protected void
setLastWriteTime(long lastWriteTime)
Sets last time at which a write occurred on the service.void
setThroughputCalculationInterval(int throughputCalculationInterval)
Sets the interval (seconds) between each throughput calculation.void
updateThroughput(long currentTime)
Updates the throughput counters.
-
-
-
Method Detail
-
getLargestManagedSessionCount
public final int getLargestManagedSessionCount()
- Returns:
- The maximum number of sessions which were being managed at the same time.
-
getCumulativeManagedSessionCount
public final long getCumulativeManagedSessionCount()
- Returns:
- The cumulative number of sessions which were managed (or are being managed) by this service, which means 'currently managed session count + closed session count'.
-
getLastIoTime
public final long getLastIoTime()
- Returns:
- the time in millis when the last I/O operation (read or write) occurred.
-
getLastReadTime
public final long getLastReadTime()
- Returns:
- The time in millis when the last read operation occurred.
-
getLastWriteTime
public final long getLastWriteTime()
- Returns:
- The time in millis when the last write operation occurred.
-
getReadBytes
public final long getReadBytes()
- Returns:
- The number of bytes this service has read so far
-
getWrittenBytes
public final long getWrittenBytes()
- Returns:
- The number of bytes this service has written so far
-
getReadMessages
public final long getReadMessages()
- Returns:
- The number of messages this services has read so far
-
getWrittenMessages
public final long getWrittenMessages()
- Returns:
- The number of messages this service has written so far
-
getReadBytesThroughput
public final double getReadBytesThroughput()
- Returns:
- The number of read bytes per second.
-
getWrittenBytesThroughput
public final double getWrittenBytesThroughput()
- Returns:
- The number of written bytes per second.
-
getReadMessagesThroughput
public final double getReadMessagesThroughput()
- Returns:
- The number of read messages per second.
-
getWrittenMessagesThroughput
public final double getWrittenMessagesThroughput()
- Returns:
- The number of written messages per second.
-
getLargestReadBytesThroughput
public final double getLargestReadBytesThroughput()
- Returns:
- The maximum number of bytes read per second since the service has been started.
-
getLargestWrittenBytesThroughput
public final double getLargestWrittenBytesThroughput()
- Returns:
- The maximum number of bytes written per second since the service has been started.
-
getLargestReadMessagesThroughput
public final double getLargestReadMessagesThroughput()
- Returns:
- The maximum number of messages read per second since the service has been started.
-
getLargestWrittenMessagesThroughput
public final double getLargestWrittenMessagesThroughput()
- Returns:
- The maximum number of messages written per second since the service has been started.
-
getThroughputCalculationInterval
public final int getThroughputCalculationInterval()
- Returns:
- the interval (seconds) between each throughput calculation. The
default value is
3
seconds.
-
getThroughputCalculationIntervalInMillis
public final long getThroughputCalculationIntervalInMillis()
- Returns:
- the interval (milliseconds) between each throughput calculation.
The default value is
3
seconds.
-
setThroughputCalculationInterval
public final void setThroughputCalculationInterval(int throughputCalculationInterval)
Sets the interval (seconds) between each throughput calculation. The default value is3
seconds.- Parameters:
throughputCalculationInterval
- The interval between two calculation
-
setLastReadTime
protected final void setLastReadTime(long lastReadTime)
Sets last time at which a read occurred on the service.- Parameters:
lastReadTime
- The last time a read has occurred
-
setLastWriteTime
protected final void setLastWriteTime(long lastWriteTime)
Sets last time at which a write occurred on the service.- Parameters:
lastWriteTime
- The last time a write has occurred
-
updateThroughput
public void updateThroughput(long currentTime)
Updates the throughput counters.- Parameters:
currentTime
- The current time
-
increaseReadBytes
public final void increaseReadBytes(long nbBytesRead, long currentTime)
Increases the count of read bytes bynbBytesRead
and sets the last read time tocurrentTime
.- Parameters:
nbBytesRead
- The number of bytes readcurrentTime
- The date those bytes were read
-
increaseReadMessages
public final void increaseReadMessages(long currentTime)
Increases the count of read messages by 1 and sets the last read time tocurrentTime
.- Parameters:
currentTime
- The time the message has been read
-
increaseWrittenBytes
public final void increaseWrittenBytes(int nbBytesWritten, long currentTime)
Increases the count of written bytes bynbBytesWritten
and sets the last write time tocurrentTime
.- Parameters:
nbBytesWritten
- The number of bytes writtencurrentTime
- The date those bytes were written
-
increaseWrittenMessages
public final void increaseWrittenMessages(long currentTime)
Increases the count of written messages by 1 and sets the last write time tocurrentTime
.- Parameters:
currentTime
- The date the message were written
-
getScheduledWriteBytes
public final int getScheduledWriteBytes()
- Returns:
- The count of bytes scheduled for write.
-
increaseScheduledWriteBytes
public final void increaseScheduledWriteBytes(int increment)
Increments byincrement
the count of bytes scheduled for write.- Parameters:
increment
- The number of added bytes fro write
-
getScheduledWriteMessages
public final int getScheduledWriteMessages()
- Returns:
- the count of messages scheduled for write.
-
increaseScheduledWriteMessages
public final void increaseScheduledWriteMessages()
Increments the count of messages scheduled for write.
-
decreaseScheduledWriteMessages
public final void decreaseScheduledWriteMessages()
Decrements the count of messages scheduled for write.
-
setLastThroughputCalculationTime
protected void setLastThroughputCalculationTime(long lastThroughputCalculationTime)
Sets the time at which throughput counters where updated.- Parameters:
lastThroughputCalculationTime
- The time at which throughput counters where updated.
-
getConfig
public final IoServiceStatistics.Config getConfig()
- Returns:
- The configuration of IoServiceStatistics
-
-