Package com.complexible.common.pool
Interface Poolable<E extends Exception>
public interface Poolable<E extends Exception>
Interface for a resource that can be used with an object Pool. Objects can implement this marker
interface to expose clean ways to clean up a resource prior to being returned to the pool, and initialize it after
its checked out of the pool. Using an object in a Pool does not require implementing this interface,
but when this is implemented, the pool implementation can better init and clean up pooled resources. Calls to
activate() and {link #deactivate} are paired in that the object, once deactivated, should require activation
before it can be used again.
- Since:
- 0.6.5
- Version:
- 0.6.5
- Author:
- Michael Grove
-
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Prepare this object for use.voidClean up the state of an object.
-
Method Details
-
activate
void activate() throws EPrepare this object for use.- Throws:
E- if the object cannot be acticated
-
deactivate
void deactivate() throws EClean up the state of an object. Should not clean it up to the extend the object can no longer be reused.- Throws:
E- if the object could not safely be deactivated
-