public class ThrottleBin extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
ThrottleBin.SumClass |
Modifier and Type | Field and Description |
---|---|
protected String |
binName
This is the bin name which this throttle belongs to.
|
protected boolean |
estimateInProgress
Flag indicating whether rate estimation is in progress yet
|
protected boolean |
estimateValid
Flag indicating whether a rate estimate is needed
|
protected boolean |
isAlive
This signals whether the bin is alive or not.
|
protected double |
localMinimum
The local minimum milliseconds per byte
|
protected double |
minimumMillisecondsPerByte
The minimum milliseconds per byte
|
protected double |
rateEstimate
The inverse rate estimate of the first fetch, in ms/byte
|
protected int |
refCount
This is the reference count for this bin (which records active references)
|
protected long |
seriesStartTime
The start time of this series
|
protected String |
serviceName
The (anonymous) service name
|
protected String |
serviceTypeName
Service type name
|
protected static String |
serviceTypePrefix
The service type prefix for throttle bins
|
protected String |
targetCalcLockName
The target calculation lock name
|
protected static String |
targetCalcLockPrefix
The target calculation lock prefix
|
protected long |
totalBytesRead
Total actual bytes read in this series; this includes fetches in progress
|
Constructor and Description |
---|
ThrottleBin(IThreadContext threadContext,
String throttlingGroupName,
String binName)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
abortFetch()
Abort the fetch.
|
void |
abortRead()
Abort a read in progress.
|
void |
beginFetch()
Note the start of a fetch operation for a bin.
|
boolean |
beginRead(int byteCount,
IBreakCheck breakCheck)
Note the start of an individual byte read of a specified size.
|
protected static String |
buildServiceTypeName(String throttlingGroupName,
String binName) |
protected static String |
buildTargetCalcLockName(String throttlingGroupName,
String binName) |
boolean |
endFetch()
Note the end of a fetch operation.
|
void |
endRead(int originalCount,
int actualCount)
Note the end of an individual read from the server.
|
String |
getBinName()
Get the bin name.
|
protected static byte[] |
pack(double targetDouble) |
void |
poll(IThreadContext threadContext)
Poll this bin
|
void |
shutDown(IThreadContext threadContext)
Shut down this bin.
|
protected static double |
unpackTarget(byte[] data) |
void |
updateMinimumMillisecondsPerByte(double min)
Update minimumMillisecondsPerBytePerServer
|
protected boolean isAlive
protected final String binName
protected final String serviceTypeName
protected final String serviceName
protected final String targetCalcLockName
protected double minimumMillisecondsPerByte
protected double localMinimum
protected volatile int refCount
protected double rateEstimate
protected volatile boolean estimateValid
protected volatile boolean estimateInProgress
protected long seriesStartTime
protected long totalBytesRead
protected static final String serviceTypePrefix
protected static final String targetCalcLockPrefix
public ThrottleBin(IThreadContext threadContext, String throttlingGroupName, String binName) throws ManifoldCFException
ManifoldCFException
protected static String buildServiceTypeName(String throttlingGroupName, String binName)
protected static String buildTargetCalcLockName(String throttlingGroupName, String binName)
public String getBinName()
public void updateMinimumMillisecondsPerByte(double min)
public void beginFetch()
public void abortFetch()
public boolean beginRead(int byteCount, IBreakCheck breakCheck) throws InterruptedException, BreakException
InterruptedException
BreakException
public void abortRead()
public void endRead(int originalCount, int actualCount)
public boolean endFetch()
public void poll(IThreadContext threadContext) throws ManifoldCFException
ManifoldCFException
public void shutDown(IThreadContext threadContext) throws ManifoldCFException
ManifoldCFException
protected static double unpackTarget(byte[] data)
protected static byte[] pack(double targetDouble)