It computes the statistics for both inbound and outbound traffic periodically at the given
checkInterval, and calls the AbstractTrafficShapingHandler#doAccounting(TrafficCounter) method back.
If the checkInterval is 0, no accounting will be done and statistics will only be computed at each
receive or write operation.
| Modifier and Type | Class and Description |
|---|---|
| private class | TrafficCounter.TrafficMonitoringTask
Class to implement monitoring at fix delay |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final AtomicLong | checkInterval
Delay between two captures |
| private final AtomicLong | cumulativeReadBytes
Long life read bytes |
| private final AtomicLong | cumulativeWrittenBytes
Long life written bytes |
| private final AtomicLong | currentReadBytes
Current read bytes |
| private final AtomicLong | currentWrittenBytes
Current written bytes |
| pack-priv final ScheduledExecutorService | executor
Executor that will run the monitor |
| private long | lastCumulativeTime
Last Time where cumulative bytes where reset to zero: this time is a real EPOC time (informative only) |
| private volatile long | lastReadBytes
Last read bytes number during last check interval |
| private volatile long | lastReadingTime
Last reading time during last check interval |
| private long | lastReadThroughput
Last reading bandwidth |
| pack-priv final AtomicLong | lastTime
Last Time Check taken |
| private long | lastWriteThroughput
Last writing bandwidth |
| private volatile long | lastWritingTime
Last future writing time during last check interval |
| private volatile long | lastWrittenBytes
Last written bytes number during last check interval |
| private static final InternalLogger | |
| pack-priv Runnable | monitor
Monitor created once in start() |
| pack-priv volatile boolean | monitorActive
Is Monitor active |
| pack-priv final String | name
Name of this Monitor |
| private long | readingTime
Last reading delay during current check interval |
| private long | realWriteThroughput
Real writing bandwidth |
| private final AtomicLong | realWrittenBytes
Real written bytes |
| pack-priv volatile ScheduledFuture | scheduledFuture
used in stop() to cancel the timer |
| pack-priv final AbstractTrafficShapingHandler | trafficShapingHandler
The associated TrafficShapingHandler |
| private long | writingTime
Last writing time during current check interval |
| Access | Constructor and Description |
|---|---|
| public | TrafficCounter(ScheduledExecutorService
the underlying executor service for scheduling checks, might be null when used
from executor, String GlobalChannelTrafficCounter.the name given to this monitor. name, long the checkInterval in millisecond between two computations. checkInterval)Constructor with the |
| public | TrafficCounter(AbstractTrafficShapingHandler
the associated AbstractTrafficShapingHandler. trafficShapingHandler, ScheduledExecutorService the underlying executor service for scheduling checks, might be null when used
from executor, String GlobalChannelTrafficCounter.the name given to this monitor. name, long the checkInterval in millisecond between two computations. checkInterval)Constructor with the |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| public long | Returns: the current checkInterval between two computations of traffic counter in millisecond.
|
| public void | configure(long
The new check interval (in milliseconds) newCheckInterval)Change checkInterval between two computations in millisecond. |
| public long | |
| public long | |
| public long | |
| public long | |
| public long | |
| public AtomicLong | |
| private void | |
| public long | Returns: the lastCumulativeTime in millisecond as of System.currentTimeMillis() when the cumulative counters were reset to 0.
|
| public long | |
| public long | |
| public long | |
| public long | |
| public long | |
| public static long | Returns: the time in ms using nanoTime, so not real EPOCH time but elapsed time in ms.
|
| public String | |
| public long | Returns: the current time to wait (in ms) if needed for Read operation.the recv size size, final long the traffic limit in bytes per second. limitTraffic, final long the max time in ms to wait in case of excess of traffic. maxTime)
Deprecated
Returns the time to wait (if any) for the given length message, using the given limitTraffic and the max wait
time.
|
| public long | Returns: the current time to wait (in ms) if needed for Read operation.the recv size size, final long the traffic limit in bytes per second limitTraffic, final long the max time in ms to wait in case of excess of traffic. maxTime, final long the current time now)Returns the time to wait (if any) for the given length message, using the given limitTraffic and the max wait time. |
| pack-priv synchronized void | resetAccounting(long
the milliseconds unix timestamp that we should be considered up-to-date for. newLastTime)Reset the accounting on Read and Write. |
| public void | resetCumulativeTime()
Reset both read and written cumulative bytes counters and the associated absolute time from System.currentTimeMillis(). |
| public synchronized void | |
| public synchronized void | |
| public String | |
| public long | Returns: the current time to wait (in ms) if needed for Write operation.the write size size, final long the traffic limit in bytes per second. limitTraffic, final long the max time in ms to wait in case of excess of traffic. maxTime)
Deprecated
Returns the time to wait (if any) for the given length message, using the given limitTraffic and
the max wait time.
|
| public long | Returns: the current time to wait (in ms) if needed for Write operation.the write size size, final long the traffic limit in bytes per second. limitTraffic, final long the max time in ms to wait in case of excess of traffic. maxTime, final long the current time now)Returns the time to wait (if any) for the given length message, using the given limitTraffic and the max wait time. |
| checkInterval | back to summary |
|---|---|
| pack-priv final AtomicLong checkInterval Delay between two captures | |
| cumulativeReadBytes | back to summary |
|---|---|
| private final AtomicLong cumulativeReadBytes Long life read bytes | |
| cumulativeWrittenBytes | back to summary |
|---|---|
| private final AtomicLong cumulativeWrittenBytes Long life written bytes | |
| currentReadBytes | back to summary |
|---|---|
| private final AtomicLong currentReadBytes Current read bytes | |
| currentWrittenBytes | back to summary |
|---|---|
| private final AtomicLong currentWrittenBytes Current written bytes | |
| executor | back to summary |
|---|---|
| pack-priv final ScheduledExecutorService executor Executor that will run the monitor | |
| lastCumulativeTime | back to summary |
|---|---|
| private long lastCumulativeTime Last Time where cumulative bytes where reset to zero: this time is a real EPOC time (informative only) | |
| lastReadBytes | back to summary |
|---|---|
| private volatile long lastReadBytes Last read bytes number during last check interval | |
| lastReadingTime | back to summary |
|---|---|
| private volatile long lastReadingTime Last reading time during last check interval | |
| lastReadThroughput | back to summary |
|---|---|
| private long lastReadThroughput Last reading bandwidth | |
| lastTime | back to summary |
|---|---|
| pack-priv final AtomicLong lastTime Last Time Check taken | |
| lastWriteThroughput | back to summary |
|---|---|
| private long lastWriteThroughput Last writing bandwidth | |
| lastWritingTime | back to summary |
|---|---|
| private volatile long lastWritingTime Last future writing time during last check interval | |
| lastWrittenBytes | back to summary |
|---|---|
| private volatile long lastWrittenBytes Last written bytes number during last check interval | |
| logger | back to summary |
|---|---|
| private static final InternalLogger logger | |
| monitor | back to summary |
|---|---|
| pack-priv Runnable monitor Monitor created once in start() | |
| monitorActive | back to summary |
|---|---|
| pack-priv volatile boolean monitorActive Is Monitor active | |
| name | back to summary |
|---|---|
| pack-priv final String name Name of this Monitor | |
| readingTime | back to summary |
|---|---|
| private long readingTime Last reading delay during current check interval | |
| realWriteThroughput | back to summary |
|---|---|
| private long realWriteThroughput Real writing bandwidth | |
| realWrittenBytes | back to summary |
|---|---|
| private final AtomicLong realWrittenBytes Real written bytes | |
| scheduledFuture | back to summary |
|---|---|
| pack-priv volatile ScheduledFuture<?> scheduledFuture used in stop() to cancel the timer | |
| trafficShapingHandler | back to summary |
|---|---|
| pack-priv final AbstractTrafficShapingHandler trafficShapingHandler The associated TrafficShapingHandler | |
| writingTime | back to summary |
|---|---|
| private long writingTime Last writing time during current check interval | |
| TrafficCounter | back to summary |
|---|---|
| public TrafficCounter(ScheduledExecutorService executor, String name, long checkInterval) Constructor with the
| |
| TrafficCounter | back to summary |
|---|---|
| public TrafficCounter(AbstractTrafficShapingHandler trafficShapingHandler, ScheduledExecutorService executor, String name, long checkInterval) Constructor with the
| |
| bytesRealWriteFlowControl | back to summary |
|---|---|
| pack-priv void bytesRealWriteFlowControl(long write) Computes counters for Real Write.
| |
| bytesRecvFlowControl | back to summary |
|---|---|
| pack-priv void bytesRecvFlowControl(long recv) Computes counters for Read.
| |
| bytesWriteFlowControl | back to summary |
|---|---|
| pack-priv void bytesWriteFlowControl(long write) Computes counters for Write.
| |
| checkInterval | back to summary |
|---|---|
public long checkInterval()
| |
| configure | back to summary |
|---|---|
| public void configure(long newCheckInterval) Change checkInterval between two computations in millisecond.
| |
| cumulativeReadBytes | back to summary |
|---|---|
public long cumulativeReadBytes()
| |
| cumulativeWrittenBytes | back to summary |
|---|---|
public long cumulativeWrittenBytes()
| |
| currentReadBytes | back to summary |
|---|---|
public long currentReadBytes()
| |
| currentWrittenBytes | back to summary |
|---|---|
public long currentWrittenBytes()
| |
| getRealWriteThroughput | back to summary |
|---|---|
public long getRealWriteThroughput()
| |
| getRealWrittenBytes | back to summary |
|---|---|
public AtomicLong getRealWrittenBytes()
| |
| init | back to summary |
|---|---|
| private void init(long checkInterval) | |
| lastCumulativeTime | back to summary |
|---|---|
public long lastCumulativeTime()
| |
| lastReadBytes | back to summary |
|---|---|
public long lastReadBytes()
| |
| lastReadThroughput | back to summary |
|---|---|
public long lastReadThroughput()
| |
| lastTime | back to summary |
|---|---|
public long lastTime()
| |
| lastWriteThroughput | back to summary |
|---|---|
public long lastWriteThroughput()
| |
| lastWrittenBytes | back to summary |
|---|---|
public long lastWrittenBytes()
| |
| milliSecondFromNano | back to summary |
|---|---|
public static long milliSecondFromNano()
| |
| name | back to summary |
|---|---|
public String name()
| |
| readTimeToWait | back to summary |
|---|---|
| public long readTimeToWait(final long size, final long limitTraffic, final long maxTime)
Deprecated
Returns the time to wait (if any) for the given length message, using the given limitTraffic and the max wait time.
| |
| readTimeToWait | back to summary |
|---|---|
| public long readTimeToWait(final long size, final long limitTraffic, final long maxTime, final long now) Returns the time to wait (if any) for the given length message, using the given limitTraffic and the max wait time.
| |
| resetAccounting | back to summary |
|---|---|
| pack-priv synchronized void resetAccounting(long newLastTime) Reset the accounting on Read and Write.
| |
| resetCumulativeTime | back to summary |
|---|---|
| public void resetCumulativeTime() Reset both read and written cumulative bytes counters and the associated absolute time from System.currentTimeMillis(). | |
| start | back to summary |
|---|---|
| public synchronized void start() Start the monitoring process. | |
| stop | back to summary |
|---|---|
| public synchronized void stop() Stop the monitoring process. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| writeTimeToWait | back to summary |
|---|---|
| public long writeTimeToWait(final long size, final long limitTraffic, final long maxTime)
Deprecated
Returns the time to wait (if any) for the given length message, using the given limitTraffic and the max wait time.
| |
| writeTimeToWait | back to summary |
|---|---|
| public long writeTimeToWait(final long size, final long limitTraffic, final long maxTime, final long now) Returns the time to wait (if any) for the given length message, using the given limitTraffic and the max wait time.
| |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| TrafficMonitoringTask | back to summary |
|---|---|
| private TrafficMonitoringTask() | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |