Class MultiPeerDownloader2
java.lang.Object
com.biglybt.core.networkmanager.impl.MultiPeerDownloader2
- All Implemented Interfaces:
RateControlledEntity
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
protected static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MultiPeerDownloader2.ConnectionList
private static final Object
private ArrayList<NetworkConnectionBase>
private final AEMonitor
private final MultiPeerDownloader2.ConnectionList
private long
private final RateHandler
private static final int
private static final Object
private EventWaiter
Fields inherited from interface com.biglybt.core.networkmanager.impl.RateControlledEntity
PRIORITY_HIGH, PRIORITY_NORMAL
-
Constructor Summary
ConstructorsConstructorDescriptionMultiPeerDownloader2
(RateHandler _main_handler) Create new downloader using the given "global" rate handler to limit all peers managed by this downloader. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPeerConnection
(NetworkConnectionBase connection) Add the given connection to the downloader.boolean
canProcess
(EventWaiter waiter) Is ready for a processing op.int
doProcessing
(EventWaiter waiter, int max_bytes) 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 changesboolean
removePeerConnection
(NetworkConnectionBase connection) Remove the given connection from the downloader.
-
Field Details
-
MOVE_TO_IDLE_TIME
private static final int MOVE_TO_IDLE_TIME- See Also:
-
ADD_ACTION
-
REMOVE_ACTION
-
connections_cow
-
connections_mon
-
main_handler
-
pending_actions
-
active_connections
-
idle_connections
-
last_idle_check
private long last_idle_check -
waiter
-
-
Constructor Details
-
MultiPeerDownloader2
Create new downloader using the given "global" rate handler to limit all peers managed by this downloader.- Parameters:
main_handler
-
-
-
Method Details
-
getRateHandler
- Specified by:
getRateHandler
in interfaceRateControlledEntity
-
addPeerConnection
Add the given connection to the downloader.- Parameters:
connection
- to add
-
removePeerConnection
Remove the given connection from the downloader.- Parameters:
connection
- to remove- Returns:
- true if the connection was found and removed, false if not removed
-
canProcess
Description copied from interface:RateControlledEntity
Is ready for a processing op.- Specified by:
canProcess
in interfaceRateControlledEntity
- Returns:
- true if it can process >0 bytes, false if not ready
-
getBytesReadyToWrite
public long getBytesReadyToWrite()- Specified by:
getBytesReadyToWrite
in interfaceRateControlledEntity
-
getConnectionCount
Description copied from interface:RateControlledEntity
If there are no connections then the waiter will be kicked when a connection arrives- Specified by:
getConnectionCount
in interfaceRateControlledEntity
- Returns:
-
getReadyConnectionCount
Description copied from interface:RateControlledEntity
The waiter is kicked if the ready condition changes- Specified by:
getReadyConnectionCount
in interfaceRateControlledEntity
- Returns:
-
doProcessing
Description copied from interface:RateControlledEntity
Attempt to do a processing operation.- Specified by:
doProcessing
in interfaceRateControlledEntity
- Returns:
- true if >0 bytes were processed (success), false if 0 bytes were processed (failure)
-
getPriority
public int getPriority()Description copied from interface:RateControlledEntity
Get this entity's priority level.- Specified by:
getPriority
in interfaceRateControlledEntity
- Returns:
- priority
-
getPriorityBoost
public boolean getPriorityBoost()Description copied from interface:RateControlledEntity
stats functions- Specified by:
getPriorityBoost
in interfaceRateControlledEntity
- Returns:
-
getString
- Specified by:
getString
in interfaceRateControlledEntity
-