public class FIFOBandwidthLimiter extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface | FIFOBandwidthLimiter.CompleteListenerListener for bandwidth request completion events. |
static interface | FIFOBandwidthLimiter.RequestA bandwidth request, either inbound or outbound. |
| Constructor and Description |
|---|
FIFOBandwidthLimiter(RouterContext context)FIFOBandwidthLimiter. |
| Modifier and Type | Method and Description |
|---|---|
int | getCurrentParticipatingBandwidth()Out bandwidth. |
int | getCurrentParticipatingBandwidthIn()In bandwidth. |
int | getInboundBurstBytes()The max inbound burst, in bytes. |
int | getInboundBurstKBytesPerSecond()The configured maximum, not the current rate. |
int | getInboundKBytesPerSecond()The configured maximum, not the current rate. |
int | getMaxShareBandwidth()In Bytes per second |
int | getOutboundBurstBytes()The max outbound burst, in bytes. |
int | getOutboundBurstKBytesPerSecond()The configured maximum, not the current rate. |
int | getOutboundKBytesPerSecond()The configured maximum, not the current rate. |
float | getReceiveBps()Smoothed one-second receive rate. |
float | getReceiveBps15s()Smoothed 15-second receive rate. |
float | getSendBps()Smoothed one-second send rate. |
float | getSendBps15s()Smoothed 15-second send rate. |
(package private) StringBuilder | getStatus()The current status string. |
long | getTotalAllocatedInboundBytes()Total bytes allocated for inbound messages since start. |
long | getTotalAllocatedOutboundBytes()Total bytes allocated for outbound messages since start. |
long | now()Current time in milliseconds from the System clock. |
boolean | receivedParticipatingMessage(int size,
float factor)Check if we should accept an inbound participating message. |
(package private) void | refillBandwidthQueues(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()Clear and reinitialize the refiller and queues. |
FIFOBandwidthLimiter.Request | requestInbound(FIFOBandwidthLimiter.Request candidate,
int bytesIn,
String purpose)Request some bytes, reusing the given request if possible. |
FIFOBandwidthLimiter.Request | requestInbound(int bytesIn,
String purpose)Request some bytes. |
FIFOBandwidthLimiter.Request | requestOutbound(FIFOBandwidthLimiter.Request candidate,
int bytesOut,
int priority,
String purpose)Request some bytes, reusing the given request if possible. |
FIFOBandwidthLimiter.Request | requestOutbound(int bytesOut,
int priority,
String purpose)Request some bytes. |
boolean | sentParticipatingMessage(int size,
float factor)We intend to send traffic for a participating tunnel
with the given size and adjustment factor. |
(package private) void | setInboundBurstBytes(int bytes)Inbound burst maximum, in bytes. |
(package private) void | setInboundBurstKBps(int kbytesPerSecond)Inbound burst rate in KBps. |
(package private) void | setOutboundBurstBytes(int bytes)Outbound burst maximum, in bytes. |
(package private) void | setOutboundBurstKBps(int kbytesPerSecond)Outbound burst rate in KBps. |
void | shutdown()Shut down the bandwidth limiter |
public FIFOBandwidthLimiter(RouterContext context)
public int getCurrentParticipatingBandwidth()
public int getCurrentParticipatingBandwidthIn()
public int getInboundBurstBytes()
public int getInboundBurstKBytesPerSecond()
public int getInboundKBytesPerSecond()
public int getMaxShareBandwidth()
public int getOutboundBurstBytes()
public int getOutboundBurstKBytesPerSecond()
public int getOutboundKBytesPerSecond()
public float getReceiveBps()
public float getReceiveBps15s()
public float getSendBps()
public float getSendBps15s()
StringBuilder getStatus()
public long getTotalAllocatedInboundBytes()
public long getTotalAllocatedOutboundBytes()
public long now()
public boolean receivedParticipatingMessage(int size,
float factor)size - bytesfactor - multiplier of size for the drop calculation, 1 for no adjustmentfinal void refillBandwidthQueues(List<FIFOBandwidthLimiter.Request> buf, long bytesInbound, long bytesOutbound, long maxBurstIn, long maxBurstOut)
buf - contains satisfied outbound requests, really just to avoid object thrash, not really usedmaxBurstIn - 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 reinitialize()
public FIFOBandwidthLimiter.Request requestInbound(FIFOBandwidthLimiter.Request candidate, int bytesIn, String purpose)
candidate - the request from a previous allocation for this
consumer, or null for a new requestbytesIn - the number of bytes requestedpurpose - the purpose of the request, for loggingpublic FIFOBandwidthLimiter.Request requestInbound(int bytesIn, String purpose)
public FIFOBandwidthLimiter.Request requestOutbound(FIFOBandwidthLimiter.Request candidate, int bytesOut, int priority, String purpose)
candidate - the request from a previous allocation for this
consumer, or null for a new requestbytesOut - the number of bytes requestedpriority - 0 for nowpurpose - the purpose of the request, for loggingpublic FIFOBandwidthLimiter.Request requestOutbound(int bytesOut, int priority, String purpose)
public boolean sentParticipatingMessage(int size,
float factor)size - bytesfactor - multiplier of size for the drop calculation, 1 for no adjustmentvoid setInboundBurstBytes(int bytes)
void setInboundBurstKBps(int kbytesPerSecond)
void setOutboundBurstBytes(int bytes)
void setOutboundBurstKBps(int kbytesPerSecond)
public void shutdown()