Package rma.util

Class ObjectPool

java.lang.Object
rma.util.ObjectPool

public abstract class ObjectPool extends Object
class to hold a pool of objects. If the pool is empty then new objects are created. As objects are returned to the pool only _minSize objects are kept around.
  • Constructor Details

    • ObjectPool

      public ObjectPool(int minSize)
    • ObjectPool

      public ObjectPool(int minSize, int maxSize)
  • Method Details

    • buildObject

      protected abstract Object buildObject()
    • getObject

      public Object getObject()
      get the next available object. if the pool is empty, get a new object. if the max number of objects outstanding is reached, wait for an object to be returned
    • returnObject

      public void returnObject(Object obj)
      return an object. If the pool is full the object not returned to the pool
    • size

      public int size()
      return the min size of the pool
    • setMaxSize

      public void setMaxSize(int max)
      set the max size of the pool
    • getMaxSize

      public int getMaxSize()
      get the max size of the pool
    • getObjectOut

      public int getObjectOut()
      get the number of outstanding objects