com.sun.grizzly.pool.PoolAdapter Maven / Gradle / Ivy
package com.sun.grizzly.pool;
/*
* An interface that describes functions to assist the DynamicPool
* A PoolAdapter will implement runtime-specific methods for initialization, cleanup, and validation of objects in a pool
*/
public interface PoolAdapter {
/**
* InitializeRuntime returns a newly-created runtime, ready to be added to the pool
* All needed configuration should be done within the RuntimeHelper
* @return The new runtime
*/
public T initializeObject();
/**
* dispose should do any needed cleanup to the runtime to ensure clean shutdown of the runtime
* @param dead The dead runtime to be disposed of
*/
public void dispose(T dead);
/**
* Validate will check a newly-returned runtime to ensure that it is in a suitable state to be re-added to the pool.
* Implementations where runtime state is unimportant can simply return true. If desired, the validate method may also
* attempt to fix invalid runtimes and return true if that succeeds.
* @param toCheck The runtime to validate
* @return true if the runtime is valid, false otherwise.
*/
public boolean validate(T toCheck);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy