protected class Throttler.ThrottlingGroup
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,ConnectionBin> |
connectionBins
The connection bins
|
protected java.util.Map<java.lang.String,FetchBin> |
fetchBins
The fetch bins
|
protected java.util.Map<java.lang.String,ThrottleBin> |
throttleBins
The throttle bins
|
protected IThrottleSpec |
throttleSpec
The current throttle spec
|
protected java.lang.String |
throttlingGroupName
The throttling group name
|
Constructor and Description |
---|
ThrottlingGroup(IThreadContext threadContext,
java.lang.String throttlingGroupType,
java.lang.String throttleGroup,
IThrottleSpec throttleSpec)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkDestroyPooledConnection(java.lang.String[] binNames,
java.util.concurrent.atomic.AtomicInteger[] poolCounts) |
boolean |
checkExpireConnection(java.lang.String[] binNames,
java.util.concurrent.atomic.AtomicInteger[] poolCounts)
Connection expiration is tricky, because even though a connection may be identified as
being expired, at the very same moment it could be handed out in another thread.
|
void |
closeStream(java.lang.String[] binNames)
Note the stream being closed.
|
IStreamThrottler |
createFetchStream(java.lang.String[] binNames) |
void |
destroy(IThreadContext threadContext)
Destroy this pool.
|
void |
freeUnusedResources(IThreadContext threadContext)
Free unused resources.
|
IFetchThrottler |
getNewConnectionFetchThrottler(java.lang.String[] binNames) |
void |
noteConnectionDestroyed(java.lang.String[] binNames) |
void |
noteConnectionReturnedToPool(java.lang.String[] binNames,
java.util.concurrent.atomic.AtomicInteger[] poolCounts) |
boolean |
noteReturnedConnection(java.lang.String[] binNames) |
IConnectionThrottler |
obtainConnectionThrottler(IThreadContext threadContext,
java.lang.String[] binNames)
Create a bunch of bins, corresponding to the bin names specified.
|
boolean |
obtainFetchDocumentPermission(java.lang.String[] binNames,
IBreakCheck breakCheck)
Get permission to fetch a document.
|
boolean |
obtainReadPermission(java.lang.String[] binNames,
int byteCount,
IBreakCheck breakCheck)
Obtain permission to read a block of bytes.
|
void |
poll(IThreadContext threadContext)
Call this periodically.
|
void |
releaseReadPermission(java.lang.String[] binNames,
int origByteCount,
int actualByteCount)
Note the completion of the read of a block of bytes.
|
void |
updateThrottleSpecification(IThrottleSpec throttleSpec)
Update the throttle spec.
|
int |
waitConnectionAvailable(java.lang.String[] binNames,
java.util.concurrent.atomic.AtomicInteger[] poolCounts,
IBreakCheck breakCheck)
Wait for a connection to become available.
|
protected final java.lang.String throttlingGroupName
protected IThrottleSpec throttleSpec
protected final java.util.Map<java.lang.String,ConnectionBin> connectionBins
protected final java.util.Map<java.lang.String,FetchBin> fetchBins
protected final java.util.Map<java.lang.String,ThrottleBin> throttleBins
public ThrottlingGroup(IThreadContext threadContext, java.lang.String throttlingGroupType, java.lang.String throttleGroup, IThrottleSpec throttleSpec) throws ManifoldCFException
ManifoldCFException
public IConnectionThrottler obtainConnectionThrottler(IThreadContext threadContext, java.lang.String[] binNames) throws ManifoldCFException
binNames
- describes the set of bins to create.ManifoldCFException
public void updateThrottleSpecification(IThrottleSpec throttleSpec) throws ManifoldCFException
throttleSpec
- is the new throttle spec for this throttle group.ManifoldCFException
public int waitConnectionAvailable(java.lang.String[] binNames, java.util.concurrent.atomic.AtomicInteger[] poolCounts, IBreakCheck breakCheck) throws java.lang.InterruptedException, BreakException
poolCounts
- is a description of how many connections
are available in the current pool, across all bins.java.lang.InterruptedException
BreakException
public IFetchThrottler getNewConnectionFetchThrottler(java.lang.String[] binNames)
public boolean noteReturnedConnection(java.lang.String[] binNames)
public boolean checkDestroyPooledConnection(java.lang.String[] binNames, java.util.concurrent.atomic.AtomicInteger[] poolCounts)
public boolean checkExpireConnection(java.lang.String[] binNames, java.util.concurrent.atomic.AtomicInteger[] poolCounts)
public void noteConnectionReturnedToPool(java.lang.String[] binNames, java.util.concurrent.atomic.AtomicInteger[] poolCounts)
public void noteConnectionDestroyed(java.lang.String[] binNames)
public boolean obtainFetchDocumentPermission(java.lang.String[] binNames, IBreakCheck breakCheck) throws java.lang.InterruptedException, BreakException
binNames
- are the names of the bins.java.lang.InterruptedException
BreakException
public IStreamThrottler createFetchStream(java.lang.String[] binNames)
public boolean obtainReadPermission(java.lang.String[] binNames, int byteCount, IBreakCheck breakCheck) throws java.lang.InterruptedException, BreakException
byteCount
- is the number of bytes to get permissions to read.java.lang.InterruptedException
BreakException
public void releaseReadPermission(java.lang.String[] binNames, int origByteCount, int actualByteCount)
origByteCount
- is the originally requested number of bytes to get permissions to read.actualByteCount
- is the number of bytes actually read.public void closeStream(java.lang.String[] binNames)
public void poll(IThreadContext threadContext) throws ManifoldCFException
ManifoldCFException
public void freeUnusedResources(IThreadContext threadContext) throws ManifoldCFException
ManifoldCFException
public void destroy(IThreadContext threadContext) throws ManifoldCFException
ManifoldCFException