net.i2p.router.transport
Class FIFOBandwidthLimiter

java.lang.Object
  extended by net.i2p.router.transport.FIFOBandwidthLimiter

public class FIFOBandwidthLimiter
extends java.lang.Object


Nested Class Summary
static interface FIFOBandwidthLimiter.CompleteListener
           
static interface FIFOBandwidthLimiter.Request
           
 
Constructor Summary
FIFOBandwidthLimiter(I2PAppContext context)
           
 
Method Summary
 FIFOBandwidthLimiter.Request createRequest()
           
(package private)  int getInboundBurstBytes()
           
 int getInboundKBytesPerSecond()
           
 boolean getInboundUnlimited()
           
(package private)  int getOutboundBurstBytes()
           
 int getOutboundKBytesPerSecond()
           
 boolean getOutboundUnlimited()
           
 float getReceiveBps()
           
 float getReceiveBps15s()
           
 float getSendBps()
           
 float getSendBps15s()
           
(package private)  java.lang.StringBuffer getStatus()
           
 long getTotalAllocatedInboundBytes()
           
 long getTotalAllocatedOutboundBytes()
           
 long getTotalWastedInboundBytes()
           
 long getTotalWastedOutboundBytes()
           
(package private) static long now()
           
(package private)  void refillBandwidthQueues(java.util.List buf, long bytesInbound, long bytesOutbound, long maxBurstIn, long maxBurstOut)
          More bytes are available - add them to the queue and satisfy any requests we can
 void reinitialize()
           
 void renderStatusHTML(java.io.Writer out)
           
 void requestInbound(FIFOBandwidthLimiter.Request req, int bytesIn, java.lang.String purpose)
           
 FIFOBandwidthLimiter.Request requestInbound(int bytesIn, java.lang.String purpose)
          Request some bytes, blocking until they become available
 FIFOBandwidthLimiter.Request requestInbound(int bytesIn, java.lang.String purpose, FIFOBandwidthLimiter.CompleteListener lsnr, java.lang.Object attachment)
           
 void requestOutbound(FIFOBandwidthLimiter.Request req, int bytesOut, java.lang.String purpose)
           
 FIFOBandwidthLimiter.Request requestOutbound(int bytesOut, java.lang.String purpose)
          Request some bytes, blocking until they become available
 FIFOBandwidthLimiter.Request requestOutbound(int bytesOut, java.lang.String purpose, FIFOBandwidthLimiter.CompleteListener lsnr, java.lang.Object attachment)
           
(package private)  void setInboundBurstBytes(int bytes)
           
(package private)  void setInboundBurstKBps(int kbytesPerSecond)
           
 void setInboundUnlimited(boolean isUnlimited)
           
(package private)  void setOutboundBurstBytes(int bytes)
           
(package private)  void setOutboundBurstKBps(int kbytesPerSecond)
           
 void setOutboundUnlimited(boolean isUnlimited)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FIFOBandwidthLimiter

public FIFOBandwidthLimiter(I2PAppContext context)
Method Detail

now

static long now()

getTotalAllocatedInboundBytes

public long getTotalAllocatedInboundBytes()

getTotalAllocatedOutboundBytes

public long getTotalAllocatedOutboundBytes()

getTotalWastedInboundBytes

public long getTotalWastedInboundBytes()

getTotalWastedOutboundBytes

public long getTotalWastedOutboundBytes()

getInboundUnlimited

public boolean getInboundUnlimited()

setInboundUnlimited

public void setInboundUnlimited(boolean isUnlimited)

getOutboundUnlimited

public boolean getOutboundUnlimited()

setOutboundUnlimited

public void setOutboundUnlimited(boolean isUnlimited)

getSendBps

public float getSendBps()

getReceiveBps

public float getReceiveBps()

getSendBps15s

public float getSendBps15s()

getReceiveBps15s

public float getReceiveBps15s()

getOutboundKBytesPerSecond

public int getOutboundKBytesPerSecond()

getInboundKBytesPerSecond

public int getInboundKBytesPerSecond()

reinitialize

public void reinitialize()

createRequest

public FIFOBandwidthLimiter.Request createRequest()

requestInbound

public FIFOBandwidthLimiter.Request requestInbound(int bytesIn,
                                                   java.lang.String purpose)
Request some bytes, blocking until they become available


requestInbound

public FIFOBandwidthLimiter.Request requestInbound(int bytesIn,
                                                   java.lang.String purpose,
                                                   FIFOBandwidthLimiter.CompleteListener lsnr,
                                                   java.lang.Object attachment)

requestInbound

public void requestInbound(FIFOBandwidthLimiter.Request req,
                           int bytesIn,
                           java.lang.String purpose)

requestOutbound

public FIFOBandwidthLimiter.Request requestOutbound(int bytesOut,
                                                    java.lang.String purpose)
Request some bytes, blocking until they become available


requestOutbound

public FIFOBandwidthLimiter.Request requestOutbound(int bytesOut,
                                                    java.lang.String purpose,
                                                    FIFOBandwidthLimiter.CompleteListener lsnr,
                                                    java.lang.Object attachment)

requestOutbound

public void requestOutbound(FIFOBandwidthLimiter.Request req,
                            int bytesOut,
                            java.lang.String purpose)

setInboundBurstKBps

void setInboundBurstKBps(int kbytesPerSecond)

setOutboundBurstKBps

void setOutboundBurstKBps(int kbytesPerSecond)

getInboundBurstBytes

int getInboundBurstBytes()

getOutboundBurstBytes

int getOutboundBurstBytes()

setInboundBurstBytes

void setInboundBurstBytes(int bytes)

setOutboundBurstBytes

void setOutboundBurstBytes(int bytes)

getStatus

java.lang.StringBuffer getStatus()

refillBandwidthQueues

final void refillBandwidthQueues(java.util.List buf,
                                 long bytesInbound,
                                 long bytesOutbound,
                                 long maxBurstIn,
                                 long maxBurstOut)
More bytes are available - add them to the queue and satisfy any requests we can

Parameters:
maxBurstIn - allow up to this many bytes in from the burst section for this time period (may be negative)
maxBurstOut - allow up to this many bytes in from the burst section for this time period (may be negative)

renderStatusHTML

public void renderStatusHTML(java.io.Writer out)
                      throws java.io.IOException
Throws:
java.io.IOException