public final class SharingObjectPool<T> extends Object implements RecyclingSupplier<T>
| Modifier and Type | Class and Description |
|---|---|
static class |
SharingObjectPool.SharedObject<T> |
RecyclingSupplier.Factory<T>| Constructor and Description |
|---|
SharingObjectPool(RecyclingSupplier.Factory<T> factory,
int coreSize,
int maxSize) |
SharingObjectPool(RecyclingSupplier.Factory<T> factory,
int coreSize,
int maxSize,
boolean asyncValidate) |
| Modifier and Type | Method and Description |
|---|---|
void |
recycle(T object)
recycle object.
|
void |
recycle(T object,
Exception e)
return a object previously borrowed from the pool,
together with a optional exception in case one was encountered
while using the object.
|
String |
toString() |
boolean |
tryDispose(long timeoutMillis) |
T |
tryGet(long deadlineNanos) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitget, get, tryGetclose, dispose, disposepublic SharingObjectPool(RecyclingSupplier.Factory<T> factory, int coreSize, int maxSize) throws ObjectCreationException
ObjectCreationExceptionpublic SharingObjectPool(RecyclingSupplier.Factory<T> factory, int coreSize, int maxSize, boolean asyncValidate) throws ObjectCreationException
ObjectCreationException@Nullable public T tryGet(long deadlineNanos) throws ObjectBorrowException, ObjectCreationException
tryGet in interface RecyclingSupplier<T>ObjectBorrowExceptionObjectCreationExceptionpublic void recycle(T object, Exception e)
RecyclingSupplierrecycle in interface RecyclingSupplier<T>object - - object to recycle.e - - exception encountered while handling the object. this is useful for the recycle to validate/retire
objectpublic void recycle(T object)
RecyclingSupplierrecycle in interface NonValidatingRecyclingSupplier<T>recycle in interface RecyclingSupplier<T>object - - object to recycle.public boolean tryDispose(long timeoutMillis)
throws ObjectDisposeException,
InterruptedException
tryDispose in interface BlockingDisposableObjectDisposeExceptionInterruptedExceptionCopyright © 2018 SPF4J. All rights reserved.