
com.amazon.ion.impl.bin.utf8.Poolable Maven / Gradle / Ivy
package com.amazon.ion.impl.bin.utf8;
import java.io.Closeable;
/**
* Base class for types that may be pooled.
* @param the concrete type.
*/
abstract class Poolable> implements Closeable {
// The pool to which this object is linked.
private final Pool pool;
/**
* @param pool the pool to which the object will be returned upon {@link #close()}.
*/
Poolable(Pool pool) {
this.pool = pool;
}
/**
* Attempts to return this instance to the pool with which it is associated, if any.
*
* Do not continue to use this instance after calling this method.
*/
@Override
public void close() {
pool.returnToPool((T) this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy