Refactored the inline thread that monitors the master and turned it into its

own class. The pool shuts down the monitors as well now.
This commit is contained in:
Hisham Mardam-Bey
2013-08-24 17:14:03 -04:00
parent c2a48afafd
commit 52286d6942
2 changed files with 173 additions and 119 deletions

View File

@@ -11,19 +11,24 @@ public abstract class Pool<T> {
/**
* Using this constructor means you have to set
* the internalPool yourself.
* and initialize the internalPool yourself.
*/
public Pool() {
this.internalPool = null;
}
public Pool() {}
public Pool(final GenericObjectPool.Config poolConfig,
PoolableObjectFactory factory) {
initPool(poolConfig, factory);
}
public void initPool(final GenericObjectPool.Config poolConfig,
PoolableObjectFactory factory) {
public void initPool(final GenericObjectPool.Config poolConfig, PoolableObjectFactory factory) {
if (this.internalPool != null) {
try {
destroy();
} catch (Exception e) {
}
}
this.internalPool = new GenericObjectPool(factory, poolConfig);
}