diff options
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/ObjectPoolFactory.java')
-rw-r--r-- | src/interfaces/jdbc/org/postgresql/ObjectPoolFactory.java | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/ObjectPoolFactory.java b/src/interfaces/jdbc/org/postgresql/ObjectPoolFactory.java deleted file mode 100644 index 404c366daa6..00000000000 --- a/src/interfaces/jdbc/org/postgresql/ObjectPoolFactory.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.postgresql; - -import java.util.Hashtable; - -/** - * Just a factory class for creating and reusing - * ObjectPool arrays of different sizes. - */ -public class ObjectPoolFactory { - private static Hashtable instances = new Hashtable(); - - ObjectPool pool = new ObjectPool(); - int maxsize; - - public static ObjectPoolFactory getInstance(int size){ - Integer s = new Integer(size); - ObjectPoolFactory poolFactory = (ObjectPoolFactory) instances.get(s); - if(poolFactory == null){ - synchronized(instances) { - poolFactory = (ObjectPoolFactory) instances.get(s); - if(poolFactory == null){ - poolFactory = new ObjectPoolFactory(size); - instances.put(s, poolFactory); - } - } - } - return poolFactory; - } - - private ObjectPoolFactory(int maxsize){ - this.maxsize = maxsize; - } - - public ObjectPool[] getObjectPoolArr(){ - ObjectPool p[] = null; - synchronized(pool){ - if(pool.size() > 0) - p = (ObjectPool []) pool.remove(); - } - if(p == null) { - p = new ObjectPool[maxsize]; - for(int i = 0; i < maxsize; i++){ - p[i] = new ObjectPool(); - } - } - return p; - } - - public void releaseObjectPoolArr(ObjectPool p[]){ - synchronized(pool){ - pool.add(p); - for(int i = 0; i < maxsize; i++){ - p[i].clear(); - } - } - } -} |