public interface PoolConfiguration
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_ACTIVE |
Modifier and Type | Method and Description |
---|---|
int |
getAbandonWhenPercentageFull()
rpc clients that have been abandoned (timed out) wont get closed and reported up unless the number of rpc clients in use are
above the percentage defined by abandonWhenPercentageFull.
|
int |
getInitialSize()
Returns the number of rpc clients that will be established when the rpc client pool is started.
|
int |
getMaxActive()
The maximum number of active rpc clients that can be allocated from this pool at the same time.
|
long |
getMaxAge()
Time in milliseconds to keep this rpc client alive even when used.
|
int |
getMaxIdle()
The maximum number of rpc clients that should be kept in the idle pool if
isPoolSweeperEnabled() returns true. |
int |
getMaxWait()
The maximum number of milliseconds that the pool will wait (when there are no available rpc clients) and the
getMaxActive() has been reached) for a rpc client to be returned
before throwing an exception. |
int |
getMinEvictableIdleTimeMillis()
The minimum amount of time an object must sit idle in the pool before it is eligible for eviction.
|
int |
getMinIdle()
The minimum number of established rpc clients that should be kept in the pool at all times.
|
int |
getRemoveAbandonedTimeout()
The time in seconds before a rpc client can be considered abandoned.
|
int |
getSuspectTimeout()
Returns the time in seconds to pass before a rpc client is marked an abanoned suspect.
|
int |
getTimeBetweenEvictionRunsMillis()
The number of milliseconds to sleep between runs of the idle rpc client validation, abandoned cleaner
and idle pool resizing.
|
boolean |
getUseLock()
Return true if a lock should be used when operations are performed on the rpc client object.
|
long |
getValidationInterval()
Avoid excess validation, only run validation at most at this frequency - time in milliseconds.
|
boolean |
isLogAbandoned()
boolean flag to set if stack traces should be logged for application code which abandoned a rpc client.
|
boolean |
isPoolSweeperEnabled()
Returns true if the pool sweeper is enabled for the rpc client pool.
|
boolean |
isRemoveAbandoned()
boolean flag to remove abandoned rpc clients if they exceed the removeAbandonedTimout.
|
boolean |
isTestOnBorrow()
The indication of whether objects will be validated before being borrowed from the pool.
|
boolean |
isTestOnReturn()
The indication of whether objects will be validated after being returned to the pool.
|
boolean |
isTestWhileIdle()
Set to true if validation should take place while the rpc client is idle.
|
void |
setAbandonWhenPercentageFull(int percentage)
rpc clients that have been abandoned (timed out) wont get closed and reported up unless the number of rpc clients in use are
above the percentage defined by abandonWhenPercentageFull.
|
void |
setInitialSize(int initialSize)
Set the number of rpc clients that will be established when the rpc client pool is started.
|
void |
setLogAbandoned(boolean logAbandoned)
boolean flag to set if stack traces should be logged for application code which abandoned a rpc client.
|
void |
setMaxActive(int maxActive)
The maximum number of active rpc clients that can be allocated from this pool at the same time.
|
void |
setMaxAge(long maxAge)
Time in milliseconds to keep this rpc client alive even when used.
|
void |
setMaxIdle(int maxIdle)
The maximum number of rpc clients that should be kept in the idle pool if
isPoolSweeperEnabled() returns false. |
void |
setMaxWait(int maxWait)
The maximum number of milliseconds that the pool will wait (when there are no available rpc clients and the
getMaxActive() has been reached) for a rpc client to be returned
before throwing an exception. |
void |
setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)
The minimum amount of time an object must sit idle in the pool before it is eligible for eviction.
|
void |
setMinIdle(int minIdle)
The minimum number of established rpc clients that should be kept in the pool at all times.
|
void |
setRemoveAbandoned(boolean removeAbandoned)
boolean flag to remove abandoned rpc clients if they exceed the removeAbandonedTimout.
|
void |
setRemoveAbandonedTimeout(int removeAbandonedTimeout)
The time in seconds before a rpc client can be considered abandoned.
|
void |
setSuspectTimeout(int seconds)
Similar to
setRemoveAbandonedTimeout(int) but instead of treating the rpc client
as abandoned, and potentially closing the rpc client, this simply logs the warning if
isLogAbandoned() returns true. |
void |
setTestOnBorrow(boolean testOnBorrow)
The indication of whether objects will be validated before being borrowed from the pool.
|
void |
setTestOnReturn(boolean testOnReturn)
The indication of whether objects will be validated after being returned to the pool.
|
void |
setTestWhileIdle(boolean testWhileIdle)
Set to true if validation should take place while the rpc client is idle.
|
void |
setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
The number of milliseconds to sleep between runs of the idle rpc client validation, abandoned cleaner
and idle pool resizing.
|
void |
setUseLock(boolean useLock)
Set to true if a lock should be used when operations are performed on the rpc client object.
|
void |
setValidationInterval(long validationInterval)
avoid excess validation, only run validation at most at this frequency - time in milliseconds.
|
static final int DEFAULT_MAX_ACTIVE
void setAbandonWhenPercentageFull(int percentage)
percentage
- a value between 0 and 100 to indicate when rpc clients that have been abandoned/timed out are considered abandonedint getAbandonWhenPercentageFull()
int getInitialSize()
void setInitialSize(int initialSize)
setMaxActive(int)
it will automatically be lowered.initialSize
- the number of rpc clients to be established.boolean isLogAbandoned()
void setLogAbandoned(boolean logAbandoned)
logAbandoned
- set to true if stack traces should be recorded.int getMaxActive()
void setMaxActive(int maxActive)
maxActive
- hard limit for number of managed rpc clients by this poolint getMaxIdle()
isPoolSweeperEnabled()
returns true.
If the If isPoolSweeperEnabled()
returns true, then the idle pool can grow up to getMaxActive()
and will be shrunk according to getMinEvictableIdleTimeMillis()
setting.
Default value is maxActive:100void setMaxIdle(int maxIdle)
isPoolSweeperEnabled()
returns false.
If the If isPoolSweeperEnabled()
returns true, then the idle pool can grow up to getMaxActive()
and will be shrunk according to getMinEvictableIdleTimeMillis()
setting.
Default value is maxActive:100maxIdle
- the maximum size of the idle poolint getMaxWait()
getMaxActive()
has been reached) for a rpc client to be returned
before throwing an exception. Default value is 30000 (30 seconds)void setMaxWait(int maxWait)
getMaxActive()
has been reached) for a rpc client to be returned
before throwing an exception. Default value is 30000 (30 seconds)maxWait
- the maximum number of milliseconds to wait.int getMinEvictableIdleTimeMillis()
void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)
minEvictableIdleTimeMillis
- the number of milliseconds a rpc client must be idle to be eligible for eviction.int getMinIdle()
getInitialSize()
(also see setTestWhileIdle(boolean)
The idle pool will not shrink below this value during an eviction run, hence the number of actual rpc clients
can be between getMinIdle()
and somewhere between getMaxIdle()
and getMaxActive()
void setMinIdle(int minIdle)
getInitialSize()
(also see setTestWhileIdle(boolean)
The idle pool will not shrink below this value during an eviction run, hence the number of actual rpc clients
can be between getMinIdle()
and somewhere between getMaxIdle()
and getMaxActive()
minIdle
- the minimum number of idle or established rpc clientsboolean isRemoveAbandoned()
getRemoveAbandonedTimeout()
and the condition for
getAbandonWhenPercentageFull()
is met.
Setting this to true can recover rpc clients from applications that fail to close a rpc client.
See also isLogAbandoned()
The default value is false.void setRemoveAbandoned(boolean removeAbandoned)
getRemoveAbandonedTimeout()
and the condition for
getAbandonWhenPercentageFull()
is met.
Setting this to true can recover rpc clients from applications that fail to close a rpc client.
See also isLogAbandoned()
The default value is false.removeAbandoned
- set to true if abandoned rpc clients can be closed and expelled out of the poolvoid setRemoveAbandonedTimeout(int removeAbandonedTimeout)
removeAbandonedTimeout
- the time in seconds before a used rpc client can be considered abandonedint getRemoveAbandonedTimeout()
boolean isTestOnBorrow()
setValidationInterval(long)
getValidationInterval()
void setTestOnBorrow(boolean testOnBorrow)
setValidationInterval(long)
testOnBorrow
- set to true if validation should take place before a rpc client is handed out to the applicationgetValidationInterval()
boolean isTestOnReturn()
setValidationInterval(long)
getValidationInterval()
void setTestOnReturn(boolean testOnReturn)
setValidationInterval(long)
testOnReturn
- true if validation should take place after a rpc client is returned to the poolgetValidationInterval()
boolean isTestWhileIdle()
setTimeBetweenEvictionRunsMillis(int)
void setTestWhileIdle(boolean testWhileIdle)
testWhileIdle
- true if validation should take place during idle checkssetTimeBetweenEvictionRunsMillis(int)
int getTimeBetweenEvictionRunsMillis()
void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
timeBetweenEvictionRunsMillis
- the sleep time in between validations in millisecondslong getValidationInterval()
void setValidationInterval(long validationInterval)
validationInterval
- the validation interval in millisecondsboolean isPoolSweeperEnabled()
boolean result = getTimeBetweenEvictionRunsMillis()>0; result = result && (isRemoveAbandoned() && getRemoveAbandonedTimeout()>0); result = result || (isTestWhileIdle(); return result;
long getMaxAge()
void setMaxAge(long maxAge)
maxAge
- the time in milliseconds a rpc client will be open for when usedboolean getUseLock()
void setUseLock(boolean useLock)
useLock
- set to true if a lock should be used on rpc client operationsvoid setSuspectTimeout(int seconds)
setRemoveAbandonedTimeout(int)
but instead of treating the rpc client
as abandoned, and potentially closing the rpc client, this simply logs the warning if
isLogAbandoned()
returns true. If this value is equal or less than 0, no suspect
checking will be performed. Suspect checking only takes place if the timeout value is larger than 0 and
the rpc client was not abandoned or if abandon check is disabled. If a rpc client is suspect a WARN message gets
logged.seconds
- - the amount of time in seconds that has to pass before a rpc client is marked suspect.int getSuspectTimeout()
Copyright © 2010–2015. All rights reserved.