[exo-jcr-commits] exo-jcr SVN: r2290 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Apr 20 09:36:20 EDT 2010


Author: sergiykarpenko
Date: 2010-04-20 09:36:19 -0400 (Tue, 20 Apr 2010)
New Revision: 2290

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java
Log:
EXOJCR-643: avoided redundant call to JBossCache on getUpdateInProgress()

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java	2010-04-20 13:30:10 UTC (rev 2289)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java	2010-04-20 13:36:19 UTC (rev 2290)
@@ -108,6 +108,8 @@
       {
          // Currently READ_ONLY is set, so new lists should be fired to multiIndex.
          cache.addCacheListener(this);
+         Object value = cache.get(parametersFqn, PARAMETER_NAME);
+         localUpdateInProgress = value != null ? (Boolean)value : false;
       }
 
    }
@@ -136,17 +138,7 @@
     */
    public boolean getUpdateInProgress()
    {
-      if (IndexerIoMode.READ_ONLY == modeHandler.getMode())
-      {
-         Object value = cache.get(parametersFqn, PARAMETER_NAME);
-         return value != null ? (Boolean)value : false;
-      }
-      else
-      {
-         // this node is read-write, so must read local value.
-         // Local value is updated every time, but remote cache value is skipped is volatile changes are performed 
-         return localUpdateInProgress;
-      }
+      return localUpdateInProgress;
    }
 
    /**
@@ -212,10 +204,11 @@
             log.warn("The data cannot be found, we will try to get it from the cache");
             value = cache.get(parametersFqn, PARAMETER_NAME);
          }
-         boolean updateInProgress = value != null ? (Boolean)value : false;
+         localUpdateInProgress = value != null ? (Boolean)value : false;
+
          for (IndexUpdateMonitorListener listener : listeners)
          {
-            listener.onUpdateInProgressChange(updateInProgress);
+            listener.onUpdateInProgressChange(localUpdateInProgress);
          }
       }
    }



More information about the exo-jcr-commits mailing list