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

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jan 21 04:34:18 EST 2010


Author: areshetnyak
Date: 2010-01-21 04:34:18 -0500 (Thu, 21 Jan 2010)
New Revision: 1520

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java
Log:
EXOJCR-424 : Make the CacheableLockManager transaction

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java	2010-01-21 09:22:48 UTC (rev 1519)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java	2010-01-21 09:34:18 UTC (rev 1520)
@@ -44,12 +44,14 @@
 import org.exoplatform.services.jcr.impl.core.lock.SessionLockManager;
 import org.exoplatform.services.jcr.impl.dataflow.TransientItemData;
 import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.TxIsolatedOperation;
 import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
 import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
 import org.exoplatform.services.jcr.observation.ExtendedEvent;
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 import org.exoplatform.services.naming.InitialContextInitializer;
+import org.exoplatform.services.transaction.TransactionService;
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheFactory;
 import org.jboss.cache.DefaultCacheFactory;
@@ -62,6 +64,8 @@
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -70,6 +74,7 @@
 
 import javax.jcr.RepositoryException;
 import javax.jcr.lock.LockException;
+import javax.transaction.TransactionManager;
 
 /**
  * Created by The eXo Platform SAS.
@@ -159,7 +164,7 @@
    private final Fqn<String> lockRoot;
 
    private Map<String, CacheableSessionLockManager> sessionLockManagers;
-
+   
    /**
     * Constructor.
     * 
@@ -169,7 +174,7 @@
     * @throws RepositoryConfigurationException
     */
    public CacheableLockManager(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
-      InitialContextInitializer context) throws RepositoryConfigurationException
+      InitialContextInitializer context, TransactionService transactionService) throws RepositoryConfigurationException
    {
       lockRoot = Fqn.fromElements(LOCKS);
       
@@ -214,6 +219,12 @@
          context.recall();
 
          cache = factory.createCache(pathToConfig, false);
+         
+         if (transactionService.getTransactionManager() != null)
+         {
+            cache.getConfiguration().getRuntimeConfig().setTransactionManager(transactionService.getTransactionManager());
+         }
+         
          cache.create();
       }
       else
@@ -332,7 +343,7 @@
             chengesLogList.add(iter.nextLog());
          }
       }
-
+      
       for (PlainChangesLog currChangesLog : chengesLogList)
       {
          String nodeIdentifier;
@@ -344,7 +355,7 @@
                   if (currChangesLog.getSize() < 2)
                   {
                      log.error("Incorrect changes log  of type ExtendedEvent.LOCK size=" + currChangesLog.getSize()
-                        + "<2 \n" + currChangesLog.dump());
+                              + "<2 \n" + currChangesLog.dump());
                      break;
                   }
                   nodeIdentifier = currChangesLog.getAllStates().get(0).getData().getParentIdentifier();
@@ -362,12 +373,12 @@
                   if (currChangesLog.getSize() < 2)
                   {
                      log.error("Incorrect changes log  of type ExtendedEvent.UNLOCK size=" + currChangesLog.getSize()
-                        + "<2 \n" + currChangesLog.dump());
+                              + "<2 \n" + currChangesLog.dump());
                      break;
                   }
 
                   internalUnLock(currChangesLog.getSessionId(), currChangesLog.getAllStates().get(0).getData()
-                     .getParentIdentifier());
+                           .getParentIdentifier());
                   break;
                default :
                   HashSet<String> removedLock = new HashSet<String>();
@@ -447,6 +458,8 @@
          }
       }
 
+      Collections.sort(removeLockList);
+      
       for (String rLock : removeLockList)
       {
          removeLock(rLock);



More information about the exo-jcr-commits mailing list