Package com.biglybt.pifimpl.local.utils
Class UtilitiesImpl.PluginLimitedRateGroup
- java.lang.Object
-
- com.biglybt.pifimpl.local.utils.UtilitiesImpl.PluginLimitedRateGroup
-
- All Implemented Interfaces:
LimitedRateGroup
- Enclosing class:
- UtilitiesImpl
public static class UtilitiesImpl.PluginLimitedRateGroup extends java.lang.Object implements LimitedRateGroup
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
current_disabled
private boolean
disable_disable
private long
last_sync
private RateLimiter
limiter
private CopyOnWriteList<UtilitiesImpl.PluginLimitedRateGroupListener>
listeners
private ConnectionManagerImpl.PluginRateLimiter
plimiter
-
Constructor Summary
Constructors Modifier Constructor Description private
PluginLimitedRateGroup(RateLimiter _limiter, boolean _disable_disable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(UtilitiesImpl.PluginLimitedRateGroupListener listener)
java.lang.String
getName()
int
getRateLimitBytesPerSecond()
Get the current rate limit.boolean
isDisabled()
Best way to check if rate limiter is effectively disabledboolean
isDisableDisable()
void
removeListener(UtilitiesImpl.PluginLimitedRateGroupListener listener)
void
updateBytesUsed(int used)
-
-
-
Field Detail
-
limiter
private RateLimiter limiter
-
plimiter
private ConnectionManagerImpl.PluginRateLimiter plimiter
-
listeners
private CopyOnWriteList<UtilitiesImpl.PluginLimitedRateGroupListener> listeners
-
disable_disable
private final boolean disable_disable
-
current_disabled
private boolean current_disabled
-
last_sync
private long last_sync
-
-
Constructor Detail
-
PluginLimitedRateGroup
private PluginLimitedRateGroup(RateLimiter _limiter, boolean _disable_disable)
-
-
Method Detail
-
isDisableDisable
public boolean isDisableDisable()
-
addListener
public void addListener(UtilitiesImpl.PluginLimitedRateGroupListener listener)
-
removeListener
public void removeListener(UtilitiesImpl.PluginLimitedRateGroupListener listener)
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceLimitedRateGroup
-
getRateLimitBytesPerSecond
public int getRateLimitBytesPerSecond()
Description copied from interface:LimitedRateGroup
Get the current rate limit.- Specified by:
getRateLimitBytesPerSecond
in interfaceLimitedRateGroup
- Returns:
- rate in bytes per second, 0 for unlimited, -1 for disabled (BUT it is better to use isDisabled as some rate limiters implement logical disablement via other means (e.g. a download can implement it by disabling individual peers....)
-
isDisabled
public boolean isDisabled()
Description copied from interface:LimitedRateGroup
Best way to check if rate limiter is effectively disabled- Specified by:
isDisabled
in interfaceLimitedRateGroup
- Returns:
-
updateBytesUsed
public void updateBytesUsed(int used)
- Specified by:
updateBytesUsed
in interfaceLimitedRateGroup
-
-