T
- - type of recycled objects@ParametersAreNonnullByDefault public interface RecyclingSupplier<T> extends NonValidatingRecyclingSupplier<T>, BlockingDisposable
Modifier and Type | Interface and Description |
---|---|
static interface |
RecyclingSupplier.Factory<T> |
Modifier and Type | Method and Description |
---|---|
default T |
get()
block until a object is available and return it.
|
default T |
get(long timeout,
TimeUnit unit) |
default 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.
|
T |
tryGet(long deadlineNanos) |
default T |
tryGet(long timeout,
TimeUnit unit) |
close, dispose, dispose, tryDispose
@Nonnull default T get() throws ObjectCreationException, ObjectBorrowException, InterruptedException, TimeoutException
NonValidatingRecyclingSupplier
get
in interface NonValidatingRecyclingSupplier<T>
ObjectCreationException
- - cannot create an object.ObjectBorrowException
- - cannot borrow an object.InterruptedException
- - interrupted.TimeoutException
- - timed out while getting object.@Nonnull default T get(long timeout, TimeUnit unit) throws ObjectCreationException, ObjectBorrowException, InterruptedException, TimeoutException
@Nullable default T tryGet(long timeout, TimeUnit unit) throws ObjectCreationException, ObjectBorrowException, InterruptedException
@Nullable T tryGet(long deadlineNanos) throws ObjectCreationException, ObjectBorrowException, InterruptedException
void recycle(T object, @Nullable Exception e)
object
- - object to recycle.e
- - exception encountered while handling the object. this is useful for the recycle to validate/retire
objectdefault void recycle(T object)
recycle
in interface NonValidatingRecyclingSupplier<T>
object
- - object to recycle.Copyright © 2018 SPF4J. All rights reserved.