Package com.io7m.jpuddle.core
Interface JPPoolSynchronousUsableType<K,T extends U,U,C>
- Type Parameters:
K- The type of keysT- The type of pooled valuesU- The type of user-visible pooled valuesC- The type of context values
- All Known Subinterfaces:
JPPoolSynchronousType<K,T, U, C>
- All Known Implementing Classes:
JPPoolSynchronous
public interface JPPoolSynchronousUsableType<K,T extends U,U,C>
The type of usable synchronous pools that yield values of type
T for
keys of type K, using context values of type C to create new
values if necessary.-
Method Summary
Modifier and TypeMethodDescriptionRetrieve an object from the pool, creating it if necessary.booleanvoidreturnValue(C context, U value) Return an object to the pool for re-use by later calls toget(Object, Object).longsize()voidTrim free objects within the pool to reduce the pool size.
-
Method Details
-
isDeleted
boolean isDeleted()- Returns:
trueiff the pool has been deleted
-
trim
Trim free objects within the pool to reduce the pool size.- Parameters:
context- A context value- Throws:
JPPoolException- On errors
-
get
Retrieve an object from the pool, creating it if necessary.- Parameters:
context- A context valuekey- The key that will be used to construct or retrieve the object- Returns:
- A new (or reused) object
- Throws:
JPPoolObjectCreationException- On exceptions raised during creation of objectsJPPoolException- On errors
-
returnValue
Return an object to the pool for re-use by later calls toget(Object, Object).- Parameters:
context- A context valuevalue- A value- Throws:
JPPoolException- On errorsJPPoolObjectReturnException- If the given value is not in the pool, or has already been returned
-
size
long size()- Returns:
- The current number of objects, active or free, within the pool
-