| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.tomp2p.utils.TrafficCounter
public class TrafficCounter
TrafficCounter is associated with AbstractTrafficShapingHandler.
 
 A TrafficCounter has for goal to count the traffic in order to enable to limit the traffic or not,
 globally or per channel. It compute statistics on read and written bytes at the specified
 interval and call back the AbstractTrafficShapingHandler doAccounting method at every
 specified interval. If this interval is set to 0, therefore no accounting will be done and only
 statistics will be computed at each receive or write operations.
| Constructor Summary | |
|---|---|
TrafficCounter(AbstractTrafficShapingHandler trafficShapingHandler,
               Executor executor,
               String name,
               long checkInterval)
Constructor with the AbstractTrafficShapingHandler that hosts it, the executorService to use, its
 name, the checkInterval between two computations in millisecond | 
|
| Method Summary | |
|---|---|
 void | 
configure(long newcheckInterval)
Change checkInterval between two computations in millisecond  | 
 long | 
getCheckInterval()
 | 
 long | 
getCumulativeReadBytes()
 | 
 long | 
getCumulativeWrittenBytes()
 | 
 long | 
getCurrentReadBytes()
 | 
 long | 
getCurrentWrittenBytes()
 | 
 long | 
getLastCumulativeTime()
 | 
 long | 
getLastReadBytes()
 | 
 long | 
getLastReadThroughput()
 | 
 long | 
getLastTime()
 | 
 long | 
getLastWriteThroughput()
 | 
 long | 
getLastWrittenBytes()
 | 
 String | 
getName()
 | 
 void | 
resetCumulativeTime()
Reset both read and written cumulative bytes counters and the associated time.  | 
 void | 
start()
Start the monitoring process  | 
 void | 
stop()
Stop the monitoring process  | 
 String | 
toString()
String information  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public TrafficCounter(AbstractTrafficShapingHandler trafficShapingHandler,
                      Executor executor,
                      String name,
                      long checkInterval)
AbstractTrafficShapingHandler that hosts it, the executorService to use, its
 name, the checkInterval between two computations in millisecond
trafficShapingHandler - the associated AbstractTrafficShapingHandlerexecutor - Should be a CachedThreadPool for efficiencyname - the name given to this monitorcheckInterval - the checkInterval in millisecond between two computations| Method Detail | 
|---|
public void start()
public void stop()
public void configure(long newcheckInterval)
newcheckInterval - public long getCheckInterval()
public long getLastReadThroughput()
public long getLastWriteThroughput()
public long getLastReadBytes()
public long getLastWrittenBytes()
public long getCurrentReadBytes()
public long getCurrentWrittenBytes()
public long getLastTime()
public long getCumulativeWrittenBytes()
public long getCumulativeReadBytes()
public long getLastCumulativeTime()
public void resetCumulativeTime()
public String getName()
public String toString()
toString in class Object
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||