Package Creational.ObjectPool
Interface Reusable
- All Known Implementing Classes:
ConcreteReusable
public interface Reusable
Interface for objects managed by the ObjectPool.
The Reusable interface defines the contract for objects that can be managed
and reused by an
ObjectPool. Implementing classes must provide
mechanisms for being used and reset to their initial state.-
Method Summary
-
Method Details
-
use
void use()Performs the primary action of the reusable object. This method simulates the usage of the object. Classes implementing this interface can define the specific behavior when the object is "used." -
reset
void reset()Resets the reusable object to its initial state. This method is invoked when the object is returned to the pool, ensuring that it is ready for reuse. Classes implementing this interface must define how their internal state is cleared or reinitialized.
-