[exo-jcr-commits] exo-jcr SVN: r1503 - 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
Wed Jan 20 07:41:55 EST 2010
Author: nzamosenchuk
Date: 2010-01-20 07:41:55 -0500 (Wed, 20 Jan 2010)
New Revision: 1503
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-423: Partially applied recommendations from issue#423. with checks if node exists. Initial structure creation is done without transactions and locally only now.
EXOJCR-396: Partially applied recommendations from issue#423. with checks if node exists. Initial structure creation is done without transactions and locally only now.
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-20 11:37:11 UTC (rev 1502)
+++ 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-20 12:41:55 UTC (rev 1503)
@@ -41,6 +41,7 @@
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
+import org.jboss.cache.UnversionedNode;
import java.io.Serializable;
import java.util.ArrayList;
@@ -106,8 +107,6 @@
public static final String LOCKS = "$LOCKS".intern();
- public static final String REFS = "$REFS".intern();
-
public static final String ITEM_DATA = "$data".intern();
public static final String ITEM_ID = "$id".intern();
@@ -126,8 +125,6 @@
protected final Fqn<String> childPropsList;
- protected final Fqn<String> refsRoot;
-
/**
* Node order comparator for getChildNodes().
*/
@@ -290,39 +287,34 @@
cache.getConfiguration().getRuntimeConfig().setTransactionManager(transactionManager);
}
- this.cache.create();
- this.cache.start();
-
this.itemsRoot = Fqn.fromElements(ITEMS);
this.childNodes = Fqn.fromElements(CHILD_NODES);
this.childProps = Fqn.fromElements(CHILD_PROPS);
this.childNodesList = Fqn.fromElements(CHILD_NODES_LIST);
this.childPropsList = Fqn.fromElements(CHILD_PROPS_LIST);
- this.refsRoot = Fqn.fromElements(REFS);
- // prepare cache structures
- prepareCache();
+ this.cache.create();
+ this.cache.start();
+
+ createResidentNode(childNodes);
+ createResidentNode(childNodesList);
+ createResidentNode(childProps);
+ createResidentNode(childPropsList);
+ createResidentNode(itemsRoot);
}
- protected void prepareCache() throws RepositoryException
+ /**
+ * Checks if node with give FQN not exists and creates resident node.
+ * @param fqn
+ */
+ protected void createResidentNode(Fqn fqn)
{
- TransactionManager txm = cache.getTransactionManager();
- final Node<Serializable, Object> cacheRoot = cache.getRoot();
- TxIsolatedOperation prepare = new TxIsolatedOperation(txm)
+ Node<Serializable, Object> cacheRoot = cache.getRoot();
+ if (!cacheRoot.hasChild(fqn))
{
- @Override
- protected void action() throws RepositoryException
- {
- cacheRoot.addChild(itemsRoot).setResident(true);
- cacheRoot.addChild(childNodes).setResident(true);
- cacheRoot.addChild(childNodesList).setResident(true);
- cacheRoot.addChild(childProps).setResident(true);
- cacheRoot.addChild(childPropsList).setResident(true);
- cacheRoot.addChild(refsRoot).setResident(true);
- }
- };
-
- prepare.perform();
+ cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
+ cacheRoot.addChild(fqn).setResident(true);
+ }
}
protected static String readJBCConfig(final WorkspaceEntry wsConfig) throws RepositoryConfigurationException
More information about the exo-jcr-commits
mailing list