/** * METHOD TO DO * * @param type PARAMETER TO DO * @param key PARAMETER TO DO * @param o PARAMETER TO DO */ public void put(int type, int key, Object o) { assert refCount > 0; if ( (type == TYPE_S_BLOCK) && (key == 8192)) { put(TYPE_BLOCK_8192, o); return; } Key k = newKeyInstance(type, key); ObjectStack os = (ObjectStack) sizedObjectStacks.get(k); if (os == null) { os = newObjectStackInstance(); sizedObjectStacks.put(k, os); } else { put(TYPE_KEY, k); } os.push(o); }
/** * Gets a pooled object of a given type and size from this pool. * * @param type The ID of the type of object to find. * @param key The size of the object to find. * @return A pooled object, or <code>null</code> if no objects are available. */ public Object get(int type, int key) { assert refCount > 0; if ( (type == TYPE_S_BLOCK) && (key == 8192)) { return get(TYPE_BLOCK_8192); } Key k = newKeyInstance(type, key); ObjectStack os = (ObjectStack) sizedObjectStacks.get(k); put(TYPE_KEY, k); if ( (os != null) && !os.isEmpty()) { return os.pop(); } if (nextPool != null) { synchronized (nextPool) { return nextPool.get(type, key); } } return null; }