You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by al...@apache.org on 2007/04/18 23:20:35 UTC

svn commit: r530162 - /incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/impl/CasManager_impl.java

Author: alally
Date: Wed Apr 18 14:20:34 2007
New Revision: 530162

URL: http://svn.apache.org/viewvc?view=rev&rev=530162
Log:
Make it possible to subclass CasManager_impl in order to override the pool sizes.
UIMA-353: http://issues.apache.org/jira/browse/UIMA-353

Modified:
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/impl/CasManager_impl.java

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/impl/CasManager_impl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/impl/CasManager_impl.java?view=diff&rev=530162&r1=530161&r2=530162
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/impl/CasManager_impl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/impl/CasManager_impl.java Wed Apr 18 14:20:34 2007
@@ -127,11 +127,12 @@
    */
   public void defineCasPool(String aRequestorContextName, int aMinimumSize,
           Properties aPerformanceTuningSettings) throws ResourceInitializationException {
-    if (aMinimumSize > 0) {
+    int poolSize = getCasPoolSize(aRequestorContextName, aMinimumSize);
+    if (poolSize > 0) {
       CasPool pool = (CasPool) mRequestorToCasPoolMap.get(aRequestorContextName);
       if (pool == null) {
         // this requestor hasn't requested a CAS before
-        pool = new CasPool(aMinimumSize, this, aPerformanceTuningSettings);
+        pool = new CasPool(poolSize, this, aPerformanceTuningSettings);
         populateCasToCasPoolMap(pool);
         mRequestorToCasPoolMap.put(aRequestorContextName, pool);
         //register with JMX
@@ -227,5 +228,19 @@
       JmxMBeanAgent.registerMBean(mbean, mMBeanServer);
     }
   }  
+  
+  /**
+   * Determines the size to use for a particular CAS Pool.  This can be overridden
+   * by subclasses to specify custom pool sizes.
+   * @param aRequestorContextName
+   *          the context name of the AE that will request the CASes
+   *          (AnalysisEngine.getUimaContextAdmin().getQualifiedContextName()).
+   * @param aMinimumSize
+   *          the minimum CAS pool size required
+   * @return the size of the CAS pool to create for the specified AE
+   */
+  protected int getCasPoolSize(String aRequestorContextName, int aMinimumSize) {
+    return aMinimumSize;
+  }
 
 }