public static class BaseObjectPool.Builder<K,V> extends Object
| Constructor and Description |
|---|
Builder(PoolableObjectFactory<K,V> factory)
BaseObjectPool's builder constructor
|
| Modifier and Type | Method and Description |
|---|---|
BaseObjectPool.Builder<K,V> |
borrowValidation(boolean borrowValidation)
Set whether this pool should validate the object by
PoolableObjectFactory.validateObject(K, V) before returning a borrowed object to the user
Default is false. |
ObjectPool<K,V> |
build()
Create an
ObjectPool instance with this builder's properties |
BaseObjectPool.Builder<K,V> |
disposable(boolean disposable)
Set disposable property
If this pool is bounded and doesn't have idle objects any more, temporary object will be returned to the user if
disposable is true. |
BaseObjectPool.Builder<K,V> |
keepAliveTimeoutInSecs(long keepAliveTimeoutInSecs)
Set the KeepAliveTimeout of this pool
This pool will schedule
EvictionTask with this interval. |
BaseObjectPool.Builder<K,V> |
max(int max)
Set maximum size of this pool
Default is unbounded as
Integer.MAX_VALUE. |
BaseObjectPool.Builder<K,V> |
min(int min)
Set minimum size of this pool
Default is 5.
|
BaseObjectPool.Builder<K,V> |
returnValidation(boolean returnValidation)
Set whether this pool should validate the object by
PoolableObjectFactory.validateObject(K, V) before returning a borrowed object to the pool
Default is false. |
public Builder(PoolableObjectFactory<K,V> factory)
factory - PoolableObjectFactory which is for creating, validating and destroying an objectpublic BaseObjectPool.Builder<K,V> min(int min)
min - min sizepublic BaseObjectPool.Builder<K,V> max(int max)
Integer.MAX_VALUE.max - max sizepublic BaseObjectPool.Builder<K,V> borrowValidation(boolean borrowValidation)
PoolableObjectFactory.validateObject(K, V) before returning a borrowed object to the user
Default is false.borrowValidation - true if validation will be neededpublic BaseObjectPool.Builder<K,V> returnValidation(boolean returnValidation)
PoolableObjectFactory.validateObject(K, V) before returning a borrowed object to the pool
Default is false.returnValidation - true if validation will be neededpublic BaseObjectPool.Builder<K,V> disposable(boolean disposable)
disposable is true.
The disposable object will be returned to the pool, it will be destroyed silently.
Default is false.disposable - true if the pool allows disposable objectspublic BaseObjectPool.Builder<K,V> keepAliveTimeoutInSecs(long keepAliveTimeoutInSecs)
EvictionTask with this interval.
EvictionTask will evict idle objects if this pool has more than min objects.
If the given parameter is negative, this pool never schedules EvictionTask.
Default is 1800.keepAliveTimeoutInSecs - KeepAliveTimeout in secondspublic ObjectPool<K,V> build()
ObjectPool instance with this builder's propertiesCopyright © 2020. All rights reserved.