Interface ObjectPool.Lease<O>
- Type Parameters:
O- The object type.
- All Superinterfaces:
AutoCloseable, Closeable
- Enclosing interface:
ObjectPool<O>
-
Method Summary
-
Method Details
-
get
O get()Returns the leased object, potentiallynullwhen discarded/closed.- Returns:
- The object, or
null.
-
close
void close()Terminates the validity of this lease. Unless discarded viadiscard(), the object may end up back in the object pool it was leased from; however that is decided by the pool.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
discard
void discard()Marks the leased object as discarded, potentially preventing it from being reused in the object pool.
-