manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1854702 - /manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/cachemanager/BaseDescription.java
Date Sun, 03 Mar 2019 13:04:45 GMT
Author: kwright
Date: Sun Mar  3 13:04:45 2019
New Revision: 1854702

URL: http://svn.apache.org/viewvc?rev=1854702&view=rev
Log:
CONNECTORS-1589: Improve caching infrastructure to allow BaseDescription property control
of maximum LRU size

Modified:
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/cachemanager/BaseDescription.java

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/cachemanager/BaseDescription.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/cachemanager/BaseDescription.java?rev=1854702&r1=1854701&r2=1854702&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/cachemanager/BaseDescription.java
(original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/cachemanager/BaseDescription.java
Sun Mar  3 13:04:45 2019
@@ -32,7 +32,7 @@ public abstract class BaseDescription im
 
   protected ICacheClass cacheClass = null;
 
-  protected final static Integer max_value = new Integer(Integer.MAX_VALUE);
+  protected final static int MAX_VALUE = Integer.MAX_VALUE;
 
   public BaseDescription(String objectClassName)
   {
@@ -40,10 +40,18 @@ public abstract class BaseDescription im
       cacheClass = new LocalCacheClass(objectClassName);
   }
 
+  public BaseDescription(String objectClassName, IThreadContext threadContext)
+    throws ManifoldCFException
+  {
+    if (objectClassName != null) {
+      cacheClass = new LocalCacheClass(objectClassName, threadContext);
+    }
+  }
+  
   public BaseDescription(String objectClassName, int maxLRUCount)
   {
     if (objectClassName != null)
-      cacheClass = new LocalCacheClass(objectClassName,maxLRUCount);
+      cacheClass = new LocalCacheClass(objectClassName, maxLRUCount);
   }
 
   /** Get the object class for an object.  The object class is used to determine
@@ -75,16 +83,21 @@ public abstract class BaseDescription im
     protected String objectClassName;
     protected Integer maxLRUCount = null;
 
+    public LocalCacheClass(String objectClassName, IThreadContext threadContext)
+      throws ManifoldCFException
+    {
+      this(objectClassName, new Integer(LockManagerFactory.getIntProperty(threadContext,
"cache."+objectClassName+".lrusize", MAX_VALUE)));
+    }
+    
     public LocalCacheClass(String objectClassName)
     {
-      this(objectClassName,-1);
+      this(objectClassName, (Integer)null);
     }
     
-    public LocalCacheClass(String objectClassName, int maxLRUCount)
+    public LocalCacheClass(String objectClassName, Integer maxLRUCount)
     {
       this.objectClassName = objectClassName;
-      if (maxLRUCount != -1)
-        this.maxLRUCount = new Integer(maxLRUCount);
+      this.maxLRUCount = maxLRUCount;
     }
 
     /** Get the name of the object class.
@@ -92,6 +105,7 @@ public abstract class BaseDescription im
     * LRU pool.
     *@return the class name.
     */
+    @Override
     public String getClassName()
     {
       return objectClassName;
@@ -101,24 +115,14 @@ public abstract class BaseDescription im
     *@return the maximum number of the objects of the particular class
     * allowed.
     */
+    @Override
     public int getMaxLRUCount()
     {
       if (maxLRUCount == null)
       {
-        try
-        {
-          String x = null; // JSKW.getProperty("cache."+objectClassName+".lrusize");
-          if (x == null)
-            maxLRUCount = max_value;
-          else
-            maxLRUCount = new Integer(x);
-        }
-        catch (Exception e)
-        {
-          maxLRUCount = max_value;
-        }
+        return MAX_VALUE;
       }
-      return maxLRUCount.intValue();
+      return maxLRUCount;
     }
   }
 }



Mime
View raw message