Interface RateControlledEntity
-
- All Known Implementing Classes:
MultiPeerDownloader2
,MultiPeerUploader
,SinglePeerDownloader
,SinglePeerUploader
public interface RateControlledEntity
Interface designation for rate-limited entities controlled by a handler.
-
-
Field Summary
Fields Modifier and Type Field Description static int
PRIORITY_HIGH
Guaranteed scheduling of processing ops, with preference over normal-priority entities.static int
PRIORITY_NORMAL
Uses fair round-robin scheduling of processing ops.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canProcess(EventWaiter waiter)
Is ready for a processing op.int
doProcessing(EventWaiter waiter, int max_bytes_permitted)
Attempt to do a processing operation.long
getBytesReadyToWrite()
int
getConnectionCount(EventWaiter waiter)
If there are no connections then the waiter will be kicked when a connection arrivesint
getPriority()
Get this entity's priority level.boolean
getPriorityBoost()
stats functionsRateHandler
getRateHandler()
int
getReadyConnectionCount(EventWaiter waiter)
The waiter is kicked if the ready condition changesjava.lang.String
getString()
-
-
-
Field Detail
-
PRIORITY_NORMAL
static final int PRIORITY_NORMAL
Uses fair round-robin scheduling of processing ops.- See Also:
- Constant Field Values
-
PRIORITY_HIGH
static final int PRIORITY_HIGH
Guaranteed scheduling of processing ops, with preference over normal-priority entities.- See Also:
- Constant Field Values
-
-
Method Detail
-
canProcess
boolean canProcess(EventWaiter waiter)
Is ready for a processing op.- Returns:
- true if it can process >0 bytes, false if not ready
-
doProcessing
int doProcessing(EventWaiter waiter, int max_bytes_permitted)
Attempt to do a processing operation.- Returns:
- true if >0 bytes were processed (success), false if 0 bytes were processed (failure)
-
getPriority
int getPriority()
Get this entity's priority level.- Returns:
- priority
-
getPriorityBoost
boolean getPriorityBoost()
stats functions- Returns:
-
getBytesReadyToWrite
long getBytesReadyToWrite()
-
getConnectionCount
int getConnectionCount(EventWaiter waiter)
If there are no connections then the waiter will be kicked when a connection arrives- Parameters:
waiter
-- Returns:
-
getReadyConnectionCount
int getReadyConnectionCount(EventWaiter waiter)
The waiter is kicked if the ready condition changes- Parameters:
waiter
-- Returns:
-
getRateHandler
RateHandler getRateHandler()
-
getString
java.lang.String getString()
-
-