Class IoServiceStatistics
java.lang.Object
org.apache.mina.core.service.IoServiceStatistics
Provides usage statistics for an
AbstractIoService instance.- Since:
- 2.0.0-M3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThis is a configuration for IoServiceStatistics. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final IoServiceStatistics.Configprivate doubleThe biggest number of bytes read per secondprivate doubleThe biggest number of messages read per secondprivate doubleThe biggest number of bytes written per secondprivate doubleThe biggest number of messages written per secondprivate longprivate longprivate longThe time the last read operation occurredprivate longprivate longThe time the last write operation occurredprivate longprivate longprivate longThe number of read bytes since the service has been startedprivate doubleThe number of bytes read per secondprivate longThe number of read messages since the service has been startedprivate doubleThe number of messages read per secondprivate intprivate intprivate final IoServiceprivate final Lockprivate longThe number of written bytes since the service has been startedprivate doubleThe number of bytes written per secondprivate longThe number of written messages since the service has been startedprivate doubleThe number of messages written per second -
Constructor Summary
ConstructorsConstructorDescriptionIoServiceStatistics(IoService service) Creates a new IoServiceStatistics instance -
Method Summary
Modifier and TypeMethodDescriptionfinal voidDecrements the count of messages scheduled for write.final longfinal intfinal doublefinal doublefinal doublefinal doublefinal longfinal longfinal longfinal longfinal doublefinal longfinal doublefinal intfinal intfinal intfinal longfinal longfinal doublefinal longfinal doublefinal voidincreaseReadBytes(long nbBytesRead, long currentTime) Increases the count of read bytes bynbBytesReadand sets the last read time tocurrentTime.final voidincreaseReadMessages(long currentTime) Increases the count of read messages by 1 and sets the last read time tocurrentTime.final voidincreaseScheduledWriteBytes(int increment) Increments byincrementthe count of bytes scheduled for write.final voidIncrements the count of messages scheduled for write.final voidincreaseWrittenBytes(int nbBytesWritten, long currentTime) Increases the count of written bytes bynbBytesWrittenand sets the last write time tocurrentTime.final voidincreaseWrittenMessages(long currentTime) Increases the count of written messages by 1 and sets the last write time tocurrentTime.private voidResets the throughput counters of the service if no session is currently managed.protected final voidsetLastReadTime(long lastReadTime) Sets last time at which a read occurred on the service.protected voidsetLastThroughputCalculationTime(long lastThroughputCalculationTime) Sets the time at which throughput counters where updated.protected final voidsetLastWriteTime(long lastWriteTime) Sets last time at which a write occurred on the service.final voidsetThroughputCalculationInterval(int throughputCalculationInterval) Sets the interval (seconds) between each throughput calculation.voidupdateThroughput(long currentTime) Updates the throughput counters.
-
Field Details
-
service
-
readBytesThroughput
private double readBytesThroughputThe number of bytes read per second -
writtenBytesThroughput
private double writtenBytesThroughputThe number of bytes written per second -
readMessagesThroughput
private double readMessagesThroughputThe number of messages read per second -
writtenMessagesThroughput
private double writtenMessagesThroughputThe number of messages written per second -
largestReadBytesThroughput
private double largestReadBytesThroughputThe biggest number of bytes read per second -
largestWrittenBytesThroughput
private double largestWrittenBytesThroughputThe biggest number of bytes written per second -
largestReadMessagesThroughput
private double largestReadMessagesThroughputThe biggest number of messages read per second -
largestWrittenMessagesThroughput
private double largestWrittenMessagesThroughputThe biggest number of messages written per second -
readBytes
private long readBytesThe number of read bytes since the service has been started -
writtenBytes
private long writtenBytesThe number of written bytes since the service has been started -
readMessages
private long readMessagesThe number of read messages since the service has been started -
writtenMessages
private long writtenMessagesThe number of written messages since the service has been started -
lastReadTime
private long lastReadTimeThe time the last read operation occurred -
lastWriteTime
private long lastWriteTimeThe time the last write operation occurred -
lastReadBytes
private long lastReadBytes -
lastWrittenBytes
private long lastWrittenBytes -
lastReadMessages
private long lastReadMessages -
lastWrittenMessages
private long lastWrittenMessages -
lastThroughputCalculationTime
private long lastThroughputCalculationTime -
scheduledWriteBytes
private int scheduledWriteBytes -
scheduledWriteMessages
private int scheduledWriteMessages -
throughputCalculationLock
-
config
-
-
Constructor Details
-
IoServiceStatistics
-
-
Method Details
-
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
3seconds.
-
getThroughputCalculationIntervalInMillis
public final long getThroughputCalculationIntervalInMillis()- Returns:
- the interval (milliseconds) between each throughput calculation.
The default value is
3seconds.
-
setThroughputCalculationInterval
public final void setThroughputCalculationInterval(int throughputCalculationInterval) Sets the interval (seconds) between each throughput calculation. The default value is3seconds.- 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
-
resetThroughput
private void resetThroughput()Resets the throughput counters of the service if no session is currently managed. -
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 bynbBytesReadand 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 bynbBytesWrittenand 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 byincrementthe 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
- Returns:
- The configuration of IoServiceStatistics
-