Interface Poolable<T extends Poolable<T>>
- Type Parameters:
T- the type of poolable
- All Known Subinterfaces:
Connection
- All Known Implementing Classes:
AbstractConnection, LoopbackConnection, TcpConnection
public interface Poolable<T extends Poolable<T>>
A resource that can be managed by a
Pool.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the resource.getPool()Gets the pool.intGets the unique ID within the pool.booleanisOpen()Returns whether the resource is open and usable.voidSets the pool.voidsetPoolId(int poolId) Sets the unique ID within the pool.
The ID is set when the poolable is retrieved from the pool.
-
Method Details
-
setPool
-
getPool
-
setPoolId
void setPoolId(int poolId) Sets the unique ID within the pool.
The ID is set when the poolable is retrieved from the pool.- Parameters:
poolId- the pool ID (0 if not lent, > 0 if lent, -1 if removed from pool)
-
getPoolId
int getPoolId()Gets the unique ID within the pool.- Returns:
- the pool ID (0 if not lent, > 0 if lent, -1 if removed from pool)
-
isOpen
boolean isOpen()Returns whether the resource is open and usable.- Returns:
- true if open
-
close
void close()Closes the resource.
-