Module com.github.robtimus.pool
Package com.github.robtimus.pool
Interface PoolableObject.Reference<X extends Exception>
-
- Type Parameters:
X
- The type of exception that can be thrown when resources are released.
- All Superinterfaces:
AutoCloseable
- Enclosing class:
- PoolableObject<X extends Exception>
public static interface PoolableObject.Reference<X extends Exception> extends AutoCloseable
A reference to aPoolableObject
. If a reference is removed or closed and no more references to thePoolableObject
from which it was created remain, thePoolableObject
will be returned to the pool it was acquired from. If it is not associated with a pool, its resources will bereleased
instead.- Author:
- Rob Spoor
- Since:
- 2.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
close()
Removes the reference to thePoolableObject
from which this reference was created.void
remove()
Removes the reference to thePoolableObject
from which this reference was created.
-
-
-
Method Detail
-
remove
void remove() throws X extends Exception
Removes the reference to thePoolableObject
from which this reference was created. If no more references remain, thePoolableObject
will be returned to the pool it was acquired from. If it is not associated with a pool, its resources will bereleased
called instead.
-
close
default void close() throws X extends Exception
Removes the reference to thePoolableObject
from which this reference was created. This method is an alias forremove()
that allows instances to be used in try-with-resources blocks.- Specified by:
close
in interfaceAutoCloseable
- Throws:
X
- If the resources could not be released.X extends Exception
-
-