[exo-jcr-commits] exo-jcr SVN: r5950 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: dataflow/persistent and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Mar 23 11:09:36 EDT 2012


Author: nzamosenchuk
Date: 2012-03-23 11:09:35 -0400 (Fri, 23 Mar 2012)
New Revision: 5950

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
Log:
EXOJCR-1825 : field latcher is AtomicReferece now. 

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java	2012-03-23 13:14:54 UTC (rev 5949)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java	2012-03-23 15:09:35 UTC (rev 5950)
@@ -96,6 +96,7 @@
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.query.InvalidQueryException;
@@ -519,7 +520,7 @@
    /**
     * Waiting query execution until resume. 
     */
-   protected CountDownLatch latcher = null;
+   protected AtomicReference<CountDownLatch> latcher = new AtomicReference<CountDownLatch>();
 
    /**
     * Indicates if component suspended or not.
@@ -3358,7 +3359,7 @@
     */
    public void suspend() throws SuspendException
    {
-      latcher = new CountDownLatch(1);
+      latcher.set(new CountDownLatch(1));
       close();
 
       isSuspended.set(true);
@@ -3374,7 +3375,7 @@
          closed = false;
          doInit();
 
-         latcher.countDown();
+         latcher.get().countDown();
 
          isSuspended.set(false);
       }
@@ -3408,7 +3409,7 @@
       {
          try
          {
-            latcher.await();
+            latcher.get().await();
          }
          catch (InterruptedException e)
          {

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java	2012-03-23 13:14:54 UTC (rev 5949)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java	2012-03-23 15:09:35 UTC (rev 5950)
@@ -74,6 +74,7 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
 
 import javax.jcr.RepositoryException;
 import javax.transaction.Status;
@@ -146,7 +147,7 @@
    /**
     * Allows to make all threads waiting until resume. 
     */
-   protected CountDownLatch latcher = null;
+   protected AtomicReference<CountDownLatch> latcher = new AtomicReference<CountDownLatch>();
 
    /**
     * Indicates that node keep responsible for resuming.
@@ -920,7 +921,7 @@
       {
          try
          {
-            latcher.await();
+            latcher.get().await();
          }
          catch (InterruptedException e)
          {
@@ -1982,7 +1983,7 @@
    {
       if (!isSuspended.get())
       {
-         latcher = new CountDownLatch(1);
+         latcher.set(new CountDownLatch(1));
          isSuspended.set(true);
 
          if (workingThreads.get() > 0)
@@ -2012,7 +2013,7 @@
    {
       if (isSuspended.get())
       {
-         latcher.countDown();
+         latcher.get().countDown();
          isSuspended.set(false);
       }
    }



More information about the exo-jcr-commits mailing list