protected static class Throttler.ConnectionThrottler extends Object implements IConnectionThrottler
Modifier and Type | Field and Description |
---|---|
protected String[] |
binNames |
protected Throttler.ThrottlingGroup |
parent |
protected AtomicInteger[] |
poolCounts |
_rcsid, CONNECTION_FROM_CREATION, CONNECTION_FROM_NOWHERE, CONNECTION_FROM_POOL
Constructor and Description |
---|
Throttler.ConnectionThrottler(Throttler.ThrottlingGroup parent,
String[] binNames) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkDestroyPooledConnection()
This method calculates whether a connection should be taken from the pool and destroyed
/* in order to meet quota requirements.
|
boolean |
checkExpireConnection()
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.
|
IFetchThrottler |
getNewConnectionFetchThrottler()
For a new connection, obtain the fetch throttler to use for the connection.
|
void |
noteConnectionDestroyed()
Note that a connection has been destroyed.
|
void |
noteConnectionReturnedToPool()
Note that a connection has been returned to the pool.
|
boolean |
noteReturnedConnection()
For returning a connection from use, there is only one method.
|
int |
waitConnectionAvailable()
Get permission to grab a connection for use.
|
int |
waitConnectionAvailable(IBreakCheck breakCheck)
Get permission to grab a connection for use.
|
protected final Throttler.ThrottlingGroup parent
protected final String[] binNames
protected final AtomicInteger[] poolCounts
public Throttler.ConnectionThrottler(Throttler.ThrottlingGroup parent, String[] binNames)
public int waitConnectionAvailable() throws InterruptedException
waitConnectionAvailable
in interface IConnectionThrottler
InterruptedException
public int waitConnectionAvailable(IBreakCheck breakCheck) throws InterruptedException, BreakException
waitConnectionAvailable
in interface IConnectionThrottler
InterruptedException
BreakException
public IFetchThrottler getNewConnectionFetchThrottler()
getNewConnectionFetchThrottler
in interface IConnectionThrottler
public boolean noteReturnedConnection()
noteReturnedConnection
in interface IConnectionThrottler
public boolean checkDestroyPooledConnection()
checkDestroyPooledConnection
in interface IConnectionThrottler
public boolean checkExpireConnection()
checkExpireConnection
in interface IConnectionThrottler
public void noteConnectionReturnedToPool()
noteConnectionReturnedToPool
in interface IConnectionThrottler
public void noteConnectionDestroyed()
noteConnectionDestroyed
in interface IConnectionThrottler