/** * Constructs an object pool. * * @param nextPool The next pool in the chain. Normally the shared pool. */ private ObjectPool(ObjectPool nextPool) { init(nextPool); }
/** * Factory method to build a new local object pool. * * @param nextPool The next pool in the chain. Normally the shared pool * @return The new object pool. */ public static ObjectPool newInstance(ObjectPool nextPool) { ObjectPool op; if (nextPool != null) { synchronized (nextPool) { op = (ObjectPool) nextPool.get(TYPE_OBJECTPOOL); } } else { op = null; } if (op != null) { op.init(nextPool); } else { op = new ObjectPool(nextPool); } return op; }