com.aelitis.azureus.core.networkmanager.impl
Class ByteBucketMT

java.lang.Object
  extended by com.aelitis.azureus.core.networkmanager.impl.ByteBucketMT
All Implemented Interfaces:
ByteBucket

public class ByteBucketMT
extends Object
implements ByteBucket


Constructor Summary
ByteBucketMT(int rate_bytes_per_sec)
          Create a new byte-bucket with the given byte fill (guaranteed) rate.
 
Method Summary
 int getAvailableByteCount()
          Get the number of bytes currently available for use.
 int getBurstRate()
          Get the configured burst rate.
 int getRate()
          Get the configured fill rate.
 void setBytesUsed(int bytes_used)
          Update the bucket with the number of bytes just used.
 void setFrozen(boolean f)
           
 void setRate(int rate_bytes_per_sec)
          Set the current fill/guaranteed rate, with a burst rate of 1.2X the given rate.
 void setRate(int rate_bytes_per_sec, int burst_rate)
          Set the current fill/guaranteed rate, along with the burst rate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteBucketMT

public ByteBucketMT(int rate_bytes_per_sec)
Create a new byte-bucket with the given byte fill (guaranteed) rate. Burst rate is set to default 1.2X of given fill rate.

Parameters:
rate_bytes_per_sec - fill rate
Method Detail

getAvailableByteCount

public int getAvailableByteCount()
Get the number of bytes currently available for use.

Specified by:
getAvailableByteCount in interface ByteBucket
Returns:
number of free bytes

setBytesUsed

public void setBytesUsed(int bytes_used)
Update the bucket with the number of bytes just used.

Specified by:
setBytesUsed in interface ByteBucket
Parameters:
bytes_used -

getRate

public int getRate()
Get the configured fill rate.

Specified by:
getRate in interface ByteBucket
Returns:
guaranteed rate in bytes per sec

getBurstRate

public int getBurstRate()
Get the configured burst rate.

Returns:
burst rate in bytes per sec

setRate

public void setRate(int rate_bytes_per_sec)
Set the current fill/guaranteed rate, with a burst rate of 1.2X the given rate.

Specified by:
setRate in interface ByteBucket
Parameters:
rate_bytes_per_sec -

setFrozen

public void setFrozen(boolean f)
Specified by:
setFrozen in interface ByteBucket

setRate

public void setRate(int rate_bytes_per_sec,
                    int burst_rate)
Set the current fill/guaranteed rate, along with the burst rate.

Parameters:
rate_bytes_per_sec -
burst_rate -