|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.router.transport.FIFOBandwidthLimiter
public class FIFOBandwidthLimiter
Concurrent plan: It's difficult to get rid of the locks on _pendingInboundRequests since locked_satisyInboundAvailable() leaves Requests on the head of the queue. When we go to Java 6, we can convert from a locked ArrayList to a LinkedBlockingDeque, where locked_sIA will poll() from the head of the queue, and if the request is not fully satisfied, offerFirst() (i.e. push) it back on the head. Ditto outbound of course. In the meantime, for Java 5, we have lockless 'shortcut' methods for the common case where we are under the bandwidth limits. And the volatile counters are now AtomicIntegers / AtomicLongs.
Nested Class Summary | |
---|---|
static interface |
FIFOBandwidthLimiter.CompleteListener
|
static interface |
FIFOBandwidthLimiter.Request
This is somewhat complicated by having both inbound and outbound in a single request. |
Constructor Summary | |
---|---|
FIFOBandwidthLimiter(I2PAppContext context)
|
Method Summary | |
---|---|
FIFOBandwidthLimiter.Request |
createRequest()
|
int |
getInboundBurstBytes()
|
int |
getInboundBurstKBytesPerSecond()
|
int |
getInboundKBytesPerSecond()
|
boolean |
getInboundUnlimited()
|
int |
getOutboundBurstBytes()
|
int |
getOutboundBurstKBytesPerSecond()
|
int |
getOutboundKBytesPerSecond()
These are the configured maximums, not the current rate |
boolean |
getOutboundUnlimited()
|
float |
getReceiveBps()
|
float |
getReceiveBps15s()
|
float |
getSendBps()
|
float |
getSendBps15s()
|
(package private) java.lang.StringBuilder |
getStatus()
|
long |
getTotalAllocatedInboundBytes()
|
long |
getTotalAllocatedOutboundBytes()
|
long |
getTotalWastedInboundBytes()
|
long |
getTotalWastedOutboundBytes()
|
long |
now()
|
(package private) void |
refillBandwidthQueues(java.util.List<FIFOBandwidthLimiter.Request> 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)
Deprecated. not worth translating |
FIFOBandwidthLimiter.Request |
requestInbound(int bytesIn,
java.lang.String purpose)
Request some bytes. |
FIFOBandwidthLimiter.Request |
requestInbound(int bytesIn,
java.lang.String purpose,
FIFOBandwidthLimiter.CompleteListener lsnr,
java.lang.Object attachment)
|
FIFOBandwidthLimiter.Request |
requestOutbound(int bytesOut,
java.lang.String purpose)
Request some bytes. |
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 |
---|
public FIFOBandwidthLimiter(I2PAppContext context)
Method Detail |
---|
public long now()
public long getTotalAllocatedInboundBytes()
public long getTotalAllocatedOutboundBytes()
public long getTotalWastedInboundBytes()
public long getTotalWastedOutboundBytes()
public boolean getInboundUnlimited()
public void setInboundUnlimited(boolean isUnlimited)
public boolean getOutboundUnlimited()
public void setOutboundUnlimited(boolean isUnlimited)
public float getSendBps()
public float getReceiveBps()
public float getSendBps15s()
public float getReceiveBps15s()
public int getOutboundKBytesPerSecond()
public int getInboundKBytesPerSecond()
public int getOutboundBurstKBytesPerSecond()
public int getInboundBurstKBytesPerSecond()
public void reinitialize()
public FIFOBandwidthLimiter.Request createRequest()
public FIFOBandwidthLimiter.Request requestInbound(int bytesIn, java.lang.String purpose)
public FIFOBandwidthLimiter.Request requestInbound(int bytesIn, java.lang.String purpose, FIFOBandwidthLimiter.CompleteListener lsnr, java.lang.Object attachment)
public FIFOBandwidthLimiter.Request requestOutbound(int bytesOut, java.lang.String purpose)
public FIFOBandwidthLimiter.Request requestOutbound(int bytesOut, java.lang.String purpose, FIFOBandwidthLimiter.CompleteListener lsnr, java.lang.Object attachment)
void setInboundBurstKBps(int kbytesPerSecond)
void setOutboundBurstKBps(int kbytesPerSecond)
public int getInboundBurstBytes()
public int getOutboundBurstBytes()
void setInboundBurstBytes(int bytes)
void setOutboundBurstBytes(int bytes)
java.lang.StringBuilder getStatus()
final void refillBandwidthQueues(java.util.List<FIFOBandwidthLimiter.Request> buf, long bytesInbound, long bytesOutbound, long maxBurstIn, long maxBurstOut)
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)public void renderStatusHTML(java.io.Writer out) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |