Merge branch 'pool-closeable-support' of https://github.com/HeartSaVioR/jedis into HeartSaVioR-pool-closeable-support
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package redis.clients.util;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
||||
import org.apache.commons.pool2.PooledObjectFactory;
|
||||
import org.apache.commons.pool2.impl.GenericObjectPool;
|
||||
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
||||
@@ -7,7 +9,7 @@ import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
||||
import redis.clients.jedis.exceptions.JedisConnectionException;
|
||||
import redis.clients.jedis.exceptions.JedisException;
|
||||
|
||||
public abstract class Pool<T> {
|
||||
public abstract class Pool<T> implements Closeable {
|
||||
protected GenericObjectPool<T> internalPool;
|
||||
|
||||
/**
|
||||
@@ -17,6 +19,15 @@ public abstract class Pool<T> {
|
||||
public Pool() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
closeInternalPool();
|
||||
}
|
||||
|
||||
public boolean isClosed() {
|
||||
return this.internalPool.isClosed();
|
||||
}
|
||||
|
||||
public Pool(final GenericObjectPoolConfig poolConfig,
|
||||
PooledObjectFactory<T> factory) {
|
||||
initPool(poolConfig, factory);
|
||||
|
||||
Reference in New Issue
Block a user