FileDocCategorySizeDatePackage
PoolBase.javaAPI DocGlassfish v2 API2828Fri May 04 22:32:08 BST 2007com.sun.enterprise.util

PoolBase

public abstract class PoolBase extends Object implements Pool
Based on Concurrent Programming in Java, Second Edition, by Doug Lea, page 222

Fields Summary
private final Semaphore
available_
private int
numItems_
Constructors Summary
protected PoolBase(int numItems)

        numItems_  = numItems;
        available_ = new SemaphoreImpl(numItems);
    
Methods Summary
protected abstract java.lang.ObjectdoGet()

protected abstract voiddoInitializeItems(int numItems)

protected abstract booleandoReturn(java.lang.Object object)

public java.lang.ObjectgetItem()

        available_.acquire();
        return doGet();
    
public voidinitialize()

        doInitializeItems(numItems_);
    
public voidreturnItem(java.lang.Object o)

        if( doReturn(o) ) {
            available_.release();
        }