|
@@ -7,6 +7,8 @@ import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
+import java.util.Set;
|
|
|
|
+
|
|
public class ClientPool<C, T> {
|
|
public class ClientPool<C, T> {
|
|
protected static final Logger logger = LoggerFactory.getLogger(ClientPool.class);
|
|
protected static final Logger logger = LoggerFactory.getLogger(ClientPool.class);
|
|
protected GenericKeyedObjectPool<String, T> clientPool;
|
|
protected GenericKeyedObjectPool<String, T> clientPool;
|
|
@@ -42,6 +44,18 @@ public class ClientPool<C, T> {
|
|
this.clientFactory.configForKey(key, config);
|
|
this.clientFactory.configForKey(key, config);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public C removeConfig(String key) {
|
|
|
|
+ return this.clientFactory.removeConfig(key);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Set<String> configKeys() {
|
|
|
|
+ return this.clientFactory.configKeys();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public C getConfig(String key) {
|
|
|
|
+ return this.clientFactory.getConfig(key);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Get a client object which is idle from the pool.
|
|
* Get a client object which is idle from the pool.
|
|
* Once the client is hold by the caller, it will be marked as active state and cannot be fetched by other caller.
|
|
* Once the client is hold by the caller, it will be marked as active state and cannot be fetched by other caller.
|