[exo-jcr-commits] exo-jcr SVN: r1429 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache.
do-not-reply at jboss.org
do-not-reply at jboss.org
Sat Jan 16 06:00:15 EST 2010
Author: pnedonosko
Date: 2010-01-16 06:00:14 -0500 (Sat, 16 Jan 2010)
New Revision: 1429
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
Log:
EXOJCR-333 transaction manager cleanup
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-01-16 10:59:13 UTC (rev 1428)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-01-16 11:00:14 UTC (rev 1429)
@@ -129,11 +129,6 @@
protected final Fqn<String> refsRoot;
/**
- * TransactionManager.
- */
- private TransactionManager transactionManager;
-
- /**
* Node order comparator for getChildNodes().
*/
class NodesOrderComparator<N extends NodeData> implements Comparator<NodeData>
@@ -298,9 +293,6 @@
this.cache.create();
this.cache.start();
- // JTA transaction manager
- this.transactionManager = transactionManager != null ? transactionManager : cache.getTransactionManager();
-
this.itemsRoot = Fqn.fromElements(ITEMS);
this.childNodes = Fqn.fromElements(CHILD_NODES);
this.childProps = Fqn.fromElements(CHILD_PROPS);
@@ -314,9 +306,11 @@
protected void prepareCache() throws RepositoryException
{
+
+ TransactionManager txm = cache.getTransactionManager();
try
{
- transactionManager.begin();
+ txm.begin();
Node<Serializable, Object> cacheRoot = cache.getRoot();
@@ -327,7 +321,7 @@
cacheRoot.addChild(this.childPropsList).setResident(true);
cacheRoot.addChild(refsRoot).setResident(true);
- transactionManager.commit();
+ txm.commit();
}
catch (RollbackException e)
{
@@ -338,7 +332,7 @@
{
try
{
- transactionManager.rollback();
+ txm.rollback();
throw new RepositoryException("Cannot preare cache", e);
}
catch (Exception e1)
@@ -362,9 +356,14 @@
}
}
+ /**
+ * Return TransactionManager used by JBossCache backing the JCR cache.
+ *
+ * @return TransactionManager
+ */
public TransactionManager getTransactionManager()
{
- return transactionManager;
+ return cache.getTransactionManager();
}
/**
@@ -582,17 +581,17 @@
{
for (Object child : set)
{
- PropertyData node = (PropertyData)cache.get(makeItemFqn((String)child), ITEM_DATA);
- if (node == null)
+ PropertyData prop = (PropertyData)cache.get(makeItemFqn((String)child), ITEM_DATA);
+ if (prop == null)
{
return null;
}
- if (withValue && node.getValues().size() <= 0)
+ if (withValue && prop.getValues().size() <= 0)
{
// don't return list of empty-valued props (but listChildProperties() can)
return null;
}
- childs.add(node);
+ childs.add(prop);
}
return childs;
}
More information about the exo-jcr-commits
mailing list