Author: tolusha
Date: 2010-07-20 10:57:30 -0400 (Tue, 20 Jul 2010)
New Revision: 2804
Modified:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/InfinispanLockManagerImpl.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/InfinispanCacheFactory.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/resources/conf/standalone/test-infinispan.xml
Log:
EXOJCR-831: first lock impl on Infinispan Test passed.
Modified:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/InfinispanLockManagerImpl.java
===================================================================
---
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/InfinispanLockManagerImpl.java 2010-07-20
13:06:41 UTC (rev 2803)
+++
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/InfinispanLockManagerImpl.java 2010-07-20
14:57:30 UTC (rev 2804)
@@ -22,7 +22,6 @@
import org.exoplatform.management.annotations.ManagedDescription;
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.config.MappedParametrizedObjectEntry;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
@@ -44,7 +43,6 @@
import org.exoplatform.services.jcr.impl.core.lock.LockRemover;
import org.exoplatform.services.jcr.impl.core.lock.SessionLockManager;
import org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManager;
-import org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl;
import
org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableSessionLockManager;
import org.exoplatform.services.jcr.impl.core.lock.jbosscache.LockData;
import org.exoplatform.services.jcr.impl.dataflow.TransientItemData;
@@ -59,6 +57,7 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.naming.InitialContextInitializer;
+import org.exoplatform.services.security.IdentityConstants;
import org.exoplatform.services.transaction.TransactionService;
import org.infinispan.Cache;
import org.picocontainer.Startable;
@@ -123,7 +122,7 @@
/**
* Logger
*/
- private final Log LOG =
ExoLogger.getLogger("exo.jcr.component.core.CacheableLockManagerImpl");
+ private final Log LOG =
ExoLogger.getLogger("exo.jcr.component.core.InfinispanLockManagerImpl");
/**
* Data manager.
@@ -202,8 +201,7 @@
this.tm = transactionManager;
// create cache using custom factory
- InfinispanCacheFactory<Serializable, Object> factory =
- new InfinispanCacheFactory<Serializable, Object>(cfm,
transactionManager);
+ InfinispanCacheFactory<Serializable, Object> factory = new
InfinispanCacheFactory<Serializable, Object>(cfm);
// configure cache loader parameters with correct DB data-types
configureJDBCCacheLoader(config.getLockManager());
@@ -213,10 +211,6 @@
// Add the cache loader needed to prevent TimeoutException
// addCacheLoader();
- PrivilegedCacheHelper.start(cache);
-
- // createStructuredNode(lockRoot);
-
// Context recall is a workaround of JDBCCacheLoader starting.
context.recall();
}
@@ -319,6 +313,7 @@
{
// Oracle suggests the use VARCHAR2 instead of VARCHAR while declaring data
type.
charType = "VARCHAR2(512)";
+ timeStampType = "NUMBER(19, 0)";
}
// POSTGRE SQL
else if (dialect.equals(DBConstants.DB_DIALECT_PGSQL))
@@ -582,7 +577,7 @@
}
}
- // sort locking and unlocking operations to avoid deadlocks in JBossCache
+ // sort locking and unlocking operations to avoid deadlocks in Infinispan
Collections.sort(containers);
for (LockOperationContainer container : containers)
{
@@ -987,7 +982,7 @@
}
PlainChangesLog changesLog =
- new PlainChangesLogImpl(new ArrayList<ItemState>(),
SystemIdentity.SYSTEM, ExtendedEvent.UNLOCK);
+ new PlainChangesLogImpl(new ArrayList<ItemState>(),
IdentityConstants.SYSTEM, ExtendedEvent.UNLOCK);
ItemData lockOwner =
copyItemData((PropertyData)dataManager.getItemData(nData, new
QPathEntry(Constants.JCR_LOCKOWNER, 1)));
@@ -1046,8 +1041,8 @@
}
/**
- * Execute the given action outside a transaction. This is needed since the {@link
Cache} used by {@link CacheableLockManagerImpl}
- * manages the persistence of its locks thanks to a {@link CacheLoader} and a {@link
CacheLoader} lock the JBoss cache {@link Node}
+ * Execute the given action outside a transaction. This is needed since the {@link
Cache} used by {@link InfinispanLockManagerImpl}
+ * manages the persistence of its locks thanks to a {@link CacheLoader} and a {@link
CacheLoader} lock the Infinispan cache {@link Node}
* even for read operations which cause deadlock issue when a XA {@link Transaction}
is already opened
* @throws LockException when a exception occurs
*/
Modified:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/InfinispanCacheFactory.java
===================================================================
---
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/InfinispanCacheFactory.java 2010-07-20
13:06:41 UTC (rev 2803)
+++
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/InfinispanCacheFactory.java 2010-07-20
14:57:30 UTC (rev 2804)
@@ -33,18 +33,15 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
-import javax.transaction.TransactionManager;
-
/**
- * Factory that creates pre-configured instances of Infinispan, without starting it.
- * Path to Infinispan configuration or template should be provided as
- * "infinispan-configuration" property in parameterEntry instance. If
- * transaction manager is configure in InfinispanCacheFactory, then it
- * is injected into the cache instance.
+ * Factory that creates and starts pre-configured instances of Infinispan.
+ * Path to Infinispan configuration or template and cache name should be
+ * provided as "infinispan-configuration" and "infinispan-cache-name"
properties
+ * in parameterEntry instance respectively.
* <br>
* If parameterEntry has "jgroups-multiplexer-stack" (=true) and
* "jgroups-configuration" parameters then Multiplexing stack is enabled
- * in JBossCache (this is highly recommended by RH specialists).
+ * in Infinispan (this is highly recommended by RH specialists).
*
* @author <a href="mailto:nikolazius@gmail.com">Nikolay
Zamosenchuk</a>
* @version $Id: ExoCacheFactoryImpl.java 34360 2009-07-22 23:58:59Z nzamosenchuk $
@@ -63,8 +60,6 @@
private final TemplateConfigurationHelper configurationHelper;
- private final TransactionManager transactionManager;
-
private ConfigurationManager configurationManager;
private final Log log =
ExoLogger.getLogger("exo.jcr.component.core.InfinispanCacheFactory");
@@ -74,40 +69,27 @@
* Transaction manager will later be injected to cache instance.
*
* @param configurationManager
- * @param transactionManager
*/
- public InfinispanCacheFactory(ConfigurationManager configurationManager,
TransactionManager transactionManager)
+ public InfinispanCacheFactory(ConfigurationManager configurationManager)
{
this.configurationManager = configurationManager;
this.configurationHelper =
TemplateConfigurationHelper.createJBossCacheHelper(configurationManager);
- this.transactionManager = transactionManager;
}
/**
- * Creates InfinispanCacheFactory with provided configuration manager and without
transaction manager.
- *
- * @param configurationManager
- */
- public InfinispanCacheFactory(ConfigurationManager configurationManager)
- {
- this(configurationManager, null);
- }
-
- /**
- * Creates pre-configured instance of Infinispan, without starting it.
- * Path to Infinispan configuration or template should be provided as
- * "jbosscache-configuration" property in parameterEntry instance. If
- * transaction manager is configure in ExoJBossCacheFactory, then it
- * is injected into the cache instance.
- * <br>
- * If parameterEntry has "jgroups-multiplexer-stack" (=true) and
- * "jgroups-configuration" parameters then Multiplexing stack is enabled
- * in JBossCache (this is highly recommended by RH specialists).
- *
- * @param parameterEntry
- * @return
- * @throws RepositoryConfigurationException
- */
+ * Factory that creates and starts pre-configured instances of Infinispan.
+ * Path to Infinispan configuration or template and cache name should be
+ * provided as "infinispan-configuration" and
"infinispan-cache-name" properties
+ * in parameterEntry instance respectively.
+ * <br>
+ * If parameterEntry has "jgroups-multiplexer-stack" (=true) and
+ * "jgroups-configuration" parameters then Multiplexing stack is enabled
+ * in Infinispan (this is highly recommended by RH specialists)
+ *
+ * @param parameterEntry
+ * @return
+ * @throws RepositoryConfigurationException
+ */
public Cache<K, V> createCache(MappedParametrizedObjectEntry parameterEntry)
throws RepositoryConfigurationException
{
// get Infinispan configuration file path and cache name
@@ -147,12 +129,6 @@
};
Cache<K, V> cache = AccessController.doPrivileged(action);
- // inject transaction manager if defined
- // if (transactionManager != null)
- // {
- //
cache.getConfiguration().getRuntimeConfig().setTransactionManager(transactionManager);
- // }
-
// JGroups multiplexer configuration if enabled
// if (parameterEntry.getParameterBoolean(JGROUPS_MUX_ENABLED, false))
// {
Modified:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/resources/conf/standalone/test-infinispan.xml
===================================================================
---
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/resources/conf/standalone/test-infinispan.xml 2010-07-20
13:06:41 UTC (rev 2803)
+++
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/resources/conf/standalone/test-infinispan.xml 2010-07-20
14:57:30 UTC (rev 2804)
@@ -1,9 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+
+-->
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:4.0
http://www.infinispan.org/schemas/infinispan-config-4.0.xsd"
xmlns="urn:infinispan:config:4.0">
+ <global>
+ <globalJmxStatistics jmxDomain="infinispan" enabled="true"
allowDuplicateDomains="true"/>
+ </global>
+
+ <default>
+ <locking isolationLevel="READ_COMMITTED"
lockAcquisitionTimeout="20000" writeSkewCheck="false"
concurrencyLevel="500"/>
+ <transaction
transactionManagerLookupClass="org.infinispan.transaction.lookup.JBossStandaloneJTAManagerLookup"
syncRollbackPhase="false" syncCommitPhase="false"/>
+ <jmxStatistics enabled="true"/>
+ <deadlockDetection enabled="true" spinDuration="100"/>
+ </default>
+
<namedCache name="lockCache">
<loaders passivation="false" shared="true"
preload="true">
<loader
class="org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore"
fetchPersistentState="false" ignoreModifications="false"
purgeOnStartup="false">