Class CPECasPool

java.lang.Object
org.apache.uima.collection.impl.cpm.engine.CPECasPool

public class CPECasPool extends Object
Implements object pooling mechanism to limit number of CAS instances. Cas'es are checked out, used and checked back in when done.
  • Constructor Details Link icon

  • Method Details Link icon

    • fillPool Link icon

      protected void fillPool(CasManager aCasManager, Properties aPerformanceTuningSettings) throws ResourceInitializationException
      Fills the pool with initialized instances of CAS.
      Parameters:
      aCasManager - - definition (type system, indexes, etc.) of CASes to create
      aPerformanceTuningSettings - the a performance tuning settings
      Throws:
      ResourceInitializationException - -
    • getCas Link icon

      public CAS getCas(long aTimeout)
      Returns a Cas instance from the pool. This routine waits for a free instance of Cas a given amount of time. If free instance is not available this routine returns null.
      Parameters:
      aTimeout - - max amount of time in millis to wait for CAS instance
      Returns:
      - CAS instance, or null on timeout
    • getCas Link icon

      public CAS getCas()
      Checks out a CAS from the pool.
      Returns:
      a CAS instance. Returns null if none are available (in which case the client may Object.wait() on this object in order to be notified when an instance becomes available).
    • releaseCas Link icon

      public void releaseCas(CAS aCas)
      Checks in a CAS to the pool. This automatically calls the CAS.reset() method, to ensure that when the CAS is later retrieved from the pool it will be ready to use. Also notifies other Threads that may be waiting for an instance to become available.
      Parameters:
      aCas - the CAS to release
    • getCheckedOutCasCount Link icon

      public int getCheckedOutCasCount()
      Returns number of CAS'es that have been checked out from pool.
      Returns:
      - number of CAS'es being processed
    • getCheckedOutCas Link icon

      public CAS getCheckedOutCas(int aIndex)
      Returns a CAS found in a given position in the list.
      Parameters:
      aIndex - - position of the CAS in the list
      Returns:
      CAS - reference to a CAS
    • getSize Link icon

      public int getSize()
      Gets the size of this pool (the total number of CAS instances that it can hold).
      Returns:
      the size of this pool