java.lang.Object
io.lettuce.core.support.BasePoolConfig.Builder
io.lettuce.core.support.BoundedPoolConfig.Builder
- Enclosing class:
- BoundedPoolConfig
public static class BoundedPoolConfig.Builder extends BasePoolConfig.Builder
Builder for
BoundedPoolConfig.-
Field Summary
Fields inherited from class io.lettuce.core.support.BasePoolConfig.Builder
testOnAcquire, testOnCreate, testOnRelease -
Constructor Summary
Constructors Modifier Constructor Description protectedBuilder() -
Method Summary
Modifier and Type Method Description BoundedPoolConfigbuild()Build a newBasePoolConfigobject.BoundedPoolConfig.BuildermaxIdle(int maxIdle)Returns the cap on the number of "idle" instances in the pool.BoundedPoolConfig.BuildermaxTotal(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.BuilderminIdle(int minIdle)Configures the minimum number of idle objects to maintain in the pool.BoundedPoolConfig.BuildertestOnAcquire()Enables validation of objects before being returned from the acquire method.BoundedPoolConfig.BuildertestOnAcquire(boolean testOnAcquire)Configures whether objects acquired from the pool will be validated before being returned from the acquire method.BoundedPoolConfig.BuildertestOnCreate()Enables validation of objects before being returned from the acquire method.BoundedPoolConfig.BuildertestOnCreate(boolean testOnCreate)Configures whether objects created for the pool will be validated before being returned from the acquire method.BoundedPoolConfig.BuildertestOnRelease()Enables validation of objects when they are returned to the pool via the release method.BoundedPoolConfig.BuildertestOnRelease(boolean testOnRelease)Configures whether objects borrowed from the pool will be validated when they are returned to the pool via the release method.
-
Constructor Details
-
Builder
protected Builder()
-
-
Method Details
-
testOnCreate
Description copied from class:BasePoolConfig.BuilderEnables validation of objects before being returned from the acquire method. Validation is performed by theAsyncObjectFactory.validate(Object)method of the factory associated with the pool. If the object fails to validate, then acquire will fail.- Overrides:
testOnCreatein classBasePoolConfig.Builder- Returns:
thisBasePoolConfig.Builder.
-
testOnCreate
Description copied from class:BasePoolConfig.BuilderConfigures whether objects created for the pool will be validated before being returned from the acquire method. Validation is performed by theAsyncObjectFactory.validate(Object)method of the factory associated with the pool. If the object fails to validate, then acquire will fail.- Overrides:
testOnCreatein classBasePoolConfig.Builder- Parameters:
testOnCreate-trueif newly created objects should be validated before being returned from the acquire method.trueto enable test on creation.- Returns:
thisBasePoolConfig.Builder.
-
testOnAcquire
Description copied from class:BasePoolConfig.BuilderEnables validation of objects before being returned from the acquire method. Validation is performed by theAsyncObjectFactory.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.- Overrides:
testOnAcquirein classBasePoolConfig.Builder- Returns:
thisBasePoolConfig.Builder.
-
testOnAcquire
Description copied from class:BasePoolConfig.BuilderConfigures whether objects acquired from the pool will be validated before being returned from the acquire method. Validation is performed by theAsyncObjectFactory.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.- Overrides:
testOnAcquirein classBasePoolConfig.Builder- Parameters:
testOnAcquire-trueif objects should be validated before being returned from the acquire method.- Returns:
thisBasePoolConfig.Builder.
-
testOnRelease
Description copied from class:BasePoolConfig.BuilderEnables validation of objects when they are returned to the pool via the release method. Validation is performed by theAsyncObjectFactory.validate(Object)method of the factory associated with the pool. Returning objects that fail validation are destroyed rather then being returned the pool.- Overrides:
testOnReleasein classBasePoolConfig.Builder- Returns:
thisBasePoolConfig.Builder.
-
testOnRelease
Description copied from class:BasePoolConfig.BuilderConfigures whether objects borrowed from the pool will be validated when they are returned to the pool via the release method. Validation is performed by theAsyncObjectFactory.validate(Object)method of the factory associated with the pool. Returning objects that fail validation are destroyed rather then being returned the pool.- Overrides:
testOnReleasein classBasePoolConfig.Builder- Parameters:
testOnRelease-trueif objects should be validated on return to the pool via the release method.- Returns:
thisBasePoolConfig.Builder.
-
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. When negative, there is no limit to the number of objects that can be managed by the pool at one time.- Parameters:
maxTotal- maximum number of objects that can be allocated by the pool.- Returns:
thisBoundedPoolConfig.Builder.
-
maxIdle
Returns the cap on the number of "idle" instances in the pool. IfmaxIdleis 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.- Parameters:
maxIdle- the cap on the number of "idle" instances in the pool.- Returns:
thisBoundedPoolConfig.Builder.
-
minIdle
Configures the minimum number of idle objects to maintain in the pool. If this is the case, an attempt is made to ensure that the pool has the required minimum number of instances during idle object eviction runs.- Parameters:
minIdle- minimum number of idle objects to maintain in the pool.- Returns:
thisBoundedPoolConfig.Builder.
-
build
Build a newBasePoolConfigobject.- Returns:
- a new
BasePoolConfigobject.
-