Class MultiPeerDownloader2
java.lang.Object
com.biglybt.core.networkmanager.impl.RateControlledMultipleEntity
com.biglybt.core.networkmanager.impl.MultiPeerDownloader2
- All Implemented Interfaces:
ControllerAllocationManagement, RateControlledEntity
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MultiPeerDownloader2.ConnectionListprivate static final Objectprivate ArrayList<NetworkConnectionBase> private final AEMonitorprivate final MultiPeerDownloader2.ConnectionListprivate longprivate final RateHandlerprivate static final intprivate final intprivate static final Objectprivate EventWaiterFields inherited from interface ControllerAllocationManagement
UNALLOCATED_PARTITIONFields inherited from interface 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 TypeMethodDescriptionvoidaddPeerConnection(NetworkConnectionBase connection) Add the given connection to the downloader.booleancanProcess(EventWaiter waiter) longdoProcessing(EventWaiter waiter, int max_bytes) Attempt to do a processing operation.longintgetConnectionCount(EventWaiter _waiter) If there are no connections then the waiter will be kicked when a connection arrivesintIs ready for a processing op.intGet this entity's priority level.booleanstats functionsintgetReadyConnectionCount(EventWaiter waiter) The waiter is kicked if the ready condition changesbooleanremovePeerConnection(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
-
partition_id
private final int partition_id- See Also:
-
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
-
getPartitionID
public int getPartitionID()Description copied from interface:RateControlledEntityIs ready for a processing op.- Returns:
- true if it can process >0 bytes, false if not ready
-
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
-
getBytesReadyToWrite
public long getBytesReadyToWrite() -
getConnectionCount
Description copied from interface:RateControlledEntityIf there are no connections then the waiter will be kicked when a connection arrives- Parameters:
_waiter-- Returns:
-
getReadyConnectionCount
Description copied from interface:RateControlledEntityThe waiter is kicked if the ready condition changes- Parameters:
waiter-- Returns:
-
doProcessing
Description copied from interface:RateControlledEntityAttempt to do a processing operation.- Returns:
- true if >0 bytes were processed (success), false if 0 bytes were processed (failure)
-
getPriority
public int getPriority()Description copied from interface:RateControlledEntityGet this entity's priority level.- Returns:
- priority
-
getPriorityBoost
public boolean getPriorityBoost()Description copied from interface:RateControlledEntitystats functions- Returns:
-
getString
-