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
FieldsModifier and TypeFieldDescriptionstatic final int
Guaranteed scheduling of processing ops, with preference over normal-priority entities.static final int
Uses fair round-robin scheduling of processing ops. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canProcess
(EventWaiter waiter) Is ready for a processing op.int
doProcessing
(EventWaiter waiter, int max_bytes_permitted) Attempt to do a processing operation.long
int
getConnectionCount
(EventWaiter waiter) If there are no connections then the waiter will be kicked when a connection arrivesint
Get this entity's priority level.boolean
stats functionsint
getReadyConnectionCount
(EventWaiter waiter) The waiter is kicked if the ready condition changes
-
Field Details
-
PRIORITY_NORMAL
static final int PRIORITY_NORMALUses fair round-robin scheduling of processing ops.- See Also:
-
PRIORITY_HIGH
static final int PRIORITY_HIGHGuaranteed scheduling of processing ops, with preference over normal-priority entities.- See Also:
-
-
Method Details
-
canProcess
Is ready for a processing op.- Returns:
- true if it can process >0 bytes, false if not ready
-
doProcessing
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
If there are no connections then the waiter will be kicked when a connection arrives- Parameters:
waiter
-- Returns:
-
getReadyConnectionCount
The waiter is kicked if the ready condition changes- Parameters:
waiter
-- Returns:
-
getRateHandler
RateHandler getRateHandler() -
getString
String getString()
-