Revision: 16683
          http://sourceforge.net/p/gate/code/16683
Author:   valyt
Date:     2013-05-14 15:04:40 +0000 (Tue, 14 May 2013)
Log Message:
-----------
Allow setting cache levels before the cache was initialised.

Modified Paths:
--------------
    mimir/trunk/plugins/db-h2/src/gate/mimir/db/DBSemanticAnnotationHelper.java

Modified: 
mimir/trunk/plugins/db-h2/src/gate/mimir/db/DBSemanticAnnotationHelper.java
===================================================================
--- mimir/trunk/plugins/db-h2/src/gate/mimir/db/DBSemanticAnnotationHelper.java 
2013-05-14 13:16:09 UTC (rev 16682)
+++ mimir/trunk/plugins/db-h2/src/gate/mimir/db/DBSemanticAnnotationHelper.java 
2013-05-14 15:04:40 UTC (rev 16683)
@@ -271,6 +271,11 @@
    */
   protected boolean level2Used = true;
   
+  
+  protected int level1CacheSize = -1;
+  protected int level2CacheSize = -1;
+  protected int level3CacheSize = -1;
+  
   /**
    * Prepared statement used to obtain the Level-1 ID based on the values of 
    * nominal features. Only used at indexing time. 
@@ -364,6 +369,10 @@
     setUriFeatures(new String[0]);
 
     cache = new AnnotationTemplateCache(this);
+    cache.setL1CacheSize(level1CacheSize);
+    cache.setL2CacheSize(level2CacheSize);
+    cache.setL3CacheSize(level3CacheSize);
+    
     // calculate the basename
     // to avoid inter-locking between the multiple SB-based indexers, they 
each 
     // create their ow database.
@@ -1311,9 +1320,14 @@
    * previously seen mention IDs.
    */
   public void setCacheSizes(int level1, int level2, int level3) {
-    cache.setL1CacheSize(level1);
-    cache.setL2CacheSize(level2);
-    cache.setL3CacheSize(level3);
+    this.level1CacheSize = level1;
+    this.level2CacheSize = level2;
+    this.level3CacheSize = level3;
+    if(cache != null) {
+      cache.setL1CacheSize(level1CacheSize);
+      cache.setL2CacheSize(level2CacheSize);
+      cache.setL3CacheSize(level3CacheSize);
+    }
   }
   
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to