Documentation of 'org.jgap.impl.Pool' Java class
Pool
org.jgap.impl

Class Pool



  • public class Pool
    extends java.lang.Object
    A simple, generic pool class that can be used to pool any kind of object. Objects can be released to this pool, either individually or as a Collection, and then later acquired again. It is not necessary for an object to have been originally acquired from the pool in order for it to be released to the pool. If there are no objects present in the pool, an attempt to acquire one will return null. The number of objects available in the pool can be determined with the size() method. Finally, it should be noted that the pool does not attempt to perform any kind of cleanup or re-initialization on the objects to restore them to some clean state when they are released to the pool; it's up to the user to reset any necessary state in the object prior to the release call (or just after the acquire call).
    Since:
    1.0
    • Constructor Summary

      Constructors 
      Constructor and Description
      Pool()
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.Object acquirePooledObject()
      Attempts to acquire an Object instance from the pool.
      void clear()
      Empties out this pool of all objects.
      void releaseAllObjects(java.util.Collection a_objectsToPool)
      Releases a Collection of objects to the pool.
      void releaseObject(java.lang.Object a_objectToPool)
      Releases an object to the pool.
      int size()
      Retrieves the number of objects currently available in this pool.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Pool

        public Pool()
        Constructor.
        Since:
        1.0
    • Method Detail

      • acquirePooledObject

        public java.lang.Object acquirePooledObject()
        Attempts to acquire an Object instance from the pool. It should be noted that no cleanup or re-initialization occurs on these objects, so it's up to the caller to reset the state of the returned Object if that's desirable.
        Returns:
        an Object instance from the pool or null if no Object instances are available in the pool
        Since:
        1.0
      • releaseObject

        public void releaseObject(java.lang.Object a_objectToPool)
        Releases an object to the pool. It's not required that the Object originated from the pool - any Object can be released to it.
        Parameters:
        a_objectToPool - the Object instance to be released into the pool
        Since:
        1.0
      • releaseAllObjects

        public void releaseAllObjects(java.util.Collection a_objectsToPool)
        Releases a Collection of objects to the pool. It's not required that the objects in the Collection originated from the pool - any objects can be released to it.
        Parameters:
        a_objectsToPool - the Collection of objects to release into the pool
        Since:
        1.0
      • size

        public int size()
        Retrieves the number of objects currently available in this pool.
        Returns:
        the number of objects in this pool
        Since:
        1.0
      • clear

        public void clear()
        Empties out this pool of all objects.
        Since:
        1.0

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.