public static class BoundedPoolConfig.Builder extends BasePoolConfig.Builder
BoundedPoolConfig
.testOnAcquire, testOnCreate, testOnRelease
Modifier | Constructor and Description |
---|---|
protected |
Builder() |
Modifier and Type | Method and Description |
---|---|
BoundedPoolConfig |
build()
Build a new
BasePoolConfig object. |
BoundedPoolConfig.Builder |
maxIdle(int maxIdle)
Returns the cap on the number of "idle" instances in the pool.
|
BoundedPoolConfig.Builder |
maxTotal(int maxTotal)
Configures the maximum number of objects that can be allocated by the pool (checked out to clients, or idle awaiting
checkout) at a given time.
|
BoundedPoolConfig.Builder |
minIdle(int minIdle)
Configures the minimum number of idle objects to maintain in the pool.
|
BoundedPoolConfig.Builder |
testOnAcquire()
Enables validation of objects before being returned from the acquire method.
|
BoundedPoolConfig.Builder |
testOnAcquire(boolean testOnAcquire)
Configures whether objects acquired from the pool will be validated before being returned from the acquire method.
|
BoundedPoolConfig.Builder |
testOnCreate()
Enables validation of objects before being returned from the acquire method.
|
BoundedPoolConfig.Builder |
testOnCreate(boolean testOnCreate)
Configures whether objects created for the pool will be validated before being returned from the acquire method.
|
BoundedPoolConfig.Builder |
testOnRelease()
Enables validation of objects when they are returned to the pool via the release method.
|
BoundedPoolConfig.Builder |
testOnRelease(boolean testOnRelease)
Configures whether objects borrowed from the pool will be validated when they are returned to the pool via the
release method.
|
public BoundedPoolConfig.Builder testOnCreate()
BasePoolConfig.Builder
AsyncObjectFactory.validate(Object)
method of the factory associated with the pool. If the object fails to
validate, then acquire will fail.testOnCreate
in class BasePoolConfig.Builder
this
BasePoolConfig.Builder
.public BoundedPoolConfig.Builder testOnCreate(boolean testOnCreate)
BasePoolConfig.Builder
AsyncObjectFactory.validate(Object)
method of the factory associated with the
pool. If the object fails to validate, then acquire will fail.testOnCreate
in class BasePoolConfig.Builder
testOnCreate
- true
if newly created objects should be validated before being returned from the
acquire method. true
to enable test on creation.this
BasePoolConfig.Builder
.public BoundedPoolConfig.Builder testOnAcquire()
BasePoolConfig.Builder
AsyncObjectFactory.validate(Object)
method of the factory associated with the pool. If the object fails to
validate, it will be removed from the pool and destroyed, and a new attempt will be made to borrow an object from the
pool.testOnAcquire
in class BasePoolConfig.Builder
this
BasePoolConfig.Builder
.public BoundedPoolConfig.Builder testOnAcquire(boolean testOnAcquire)
BasePoolConfig.Builder
AsyncObjectFactory.validate(Object)
method of the factory associated with the
pool. If the object fails to validate, it will be removed from the pool and destroyed, and a new attempt will be made
to borrow an object from the pool.testOnAcquire
in class BasePoolConfig.Builder
testOnAcquire
- true
if objects should be validated before being returned from the acquire method.this
BasePoolConfig.Builder
.public BoundedPoolConfig.Builder testOnRelease()
BasePoolConfig.Builder
AsyncObjectFactory.validate(Object)
method of the factory associated with the pool. Returning objects
that fail validation are destroyed rather then being returned the pool.testOnRelease
in class BasePoolConfig.Builder
this
BasePoolConfig.Builder
.public BoundedPoolConfig.Builder testOnRelease(boolean testOnRelease)
BasePoolConfig.Builder
AsyncObjectFactory.validate(Object)
method of the factory
associated with the pool. Returning objects that fail validation are destroyed rather then being returned the pool.testOnRelease
in class BasePoolConfig.Builder
testOnRelease
- true
if objects should be validated on return to the pool via the release method.this
BasePoolConfig.Builder
.public BoundedPoolConfig.Builder maxTotal(int maxTotal)
maxTotal
- maximum number of objects that can be allocated by the pool.this
BoundedPoolConfig.Builder
.public BoundedPoolConfig.Builder maxIdle(int maxIdle)
maxIdle
is set too low on heavily loaded
systems it is possible you will see objects being destroyed and almost immediately new objects being created. This is
a result of the active threads momentarily returning objects faster than they are requesting them them, causing the
number of idle objects to rise above maxIdle. The best value for maxIdle for heavily loaded system will vary but the
default is a good starting point.maxIdle
- the cap on the number of "idle" instances in the pool.this
BoundedPoolConfig.Builder
.public BoundedPoolConfig.Builder minIdle(int minIdle)
minIdle
- minimum number of idle objects to maintain in the pool.this
BoundedPoolConfig.Builder
.public BoundedPoolConfig build()
BasePoolConfig
object.BasePoolConfig
object.Copyright © 2021 lettuce.io. All rights reserved.