[exo-jcr-commits] exo-jcr SVN: r2284 - in jcr/trunk/exo.jcr.component.core/src: main/resources/conf/portal and 2 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Apr 15 11:06:49 EDT 2010
Author: areshetnyak
Date: 2010-04-15 11:06:48 -0400 (Thu, 15 Apr 2010)
New Revision: 2284
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/jbosscache-data.xml
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml
Log:
EXOJCR-545 : The update trunk to use ExpirationAlgorithm.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2010-04-15 13:54:14 UTC (rev 2283)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2010-04-15 15:06:48 UTC (rev 2284)
@@ -18,6 +18,14 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.transaction.TransactionManager;
+
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jboss.cache.Cache;
@@ -30,17 +38,10 @@
import org.jboss.cache.NodeNotExistsException;
import org.jboss.cache.Region;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jgroups.Address;
-import java.io.Serializable;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.transaction.TransactionManager;
-
/**
* Decorator over the JBossCache that stores changes in buffer, then sorts and applies to JBossCache.
*
@@ -51,8 +52,6 @@
@SuppressWarnings("unchecked")
public class BufferedJBossCache implements Cache<Serializable, Object>
{
- // private final Log log = ExoLogger.getLogger("exo.jcr.component.core.BufferedJbossCache");
-
/**
* Parent cache.
*/
@@ -61,14 +60,20 @@
private final ThreadLocal<CompressedChangesBuffer> changesList = new ThreadLocal<CompressedChangesBuffer>();
private ThreadLocal<Boolean> local = new ThreadLocal<Boolean>();
+
+ private final boolean useExpiration;
+
+ private final long expirationTimeOut;
protected static final Log LOG =
ExoLogger.getLogger("org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache");
- public BufferedJBossCache(Cache<Serializable, Object> parentCache)
+ public BufferedJBossCache(Cache<Serializable, Object> parentCache, boolean useExpiration, long expirationTimeOut)
{
super();
this.parentCache = parentCache;
+ this.useExpiration = useExpiration;
+ this.expirationTimeOut = expirationTimeOut;
}
/**
@@ -451,7 +456,7 @@
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new PutObjectContainer(fqn, data, parentCache, changesContainer.getHistoryIndex(), local
- .get()));
+ .get(), useExpiration, expirationTimeOut));
}
/* (non-Javadoc)
@@ -461,7 +466,7 @@
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get()));
+ local.get(), useExpiration, expirationTimeOut));
return parentCache.get(fqn, key);
}
@@ -474,7 +479,7 @@
Object prevObject = getObjectFromChangesContainer(changesContainer, fqn, key);
changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get()));
+ local.get(), useExpiration, expirationTimeOut));
if (prevObject != null)
{
@@ -537,7 +542,7 @@
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new RemoveKeyContainer(fqn, key, parentCache, changesContainer.getHistoryIndex(), local
- .get()));
+ .get(), useExpiration, expirationTimeOut));
return parentCache.get(fqn, key);
}
@@ -579,7 +584,8 @@
public boolean removeNode(Fqn fqn)
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
- changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.getHistoryIndex(), local.get()));
+ changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.getHistoryIndex(), local.get(),
+ useExpiration, expirationTimeOut));
return true;
}
@@ -648,7 +654,7 @@
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new AddToListContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get()));
+ local.get(), useExpiration, expirationTimeOut));
}
/**
@@ -662,7 +668,7 @@
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new RemoveFromListContainer(fqn, key, value, parentCache,
- changesContainer.getHistoryIndex(), local.get()));
+ changesContainer.getHistoryIndex(), local.get(), useExpiration, expirationTimeOut));
}
public static enum ChangesType {
@@ -684,8 +690,12 @@
protected final boolean localMode;
+ protected final boolean useExpiration;
+
+ protected final long timeOut;
+
public ChangesContainer(Fqn fqn, ChangesType changesType, Cache<Serializable, Object> cache, int historicalIndex,
- boolean localMode)
+ boolean localMode, boolean useExpiration, long timeOut)
{
super();
this.fqn = fqn;
@@ -693,6 +703,8 @@
this.cache = cache;
this.historicalIndex = historicalIndex;
this.localMode = localMode;
+ this.useExpiration = useExpiration;
+ this.timeOut = timeOut;
}
/**
@@ -738,6 +750,12 @@
{
cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(localMode);
}
+
+ public final void putExpiration(Fqn efqn)
+ {
+ setCacheLocalMode();
+ cache.put(efqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + timeOut));
+ }
public abstract void apply();
}
@@ -750,9 +768,9 @@
private final Map<? extends Serializable, ? extends Object> data;
public PutObjectContainer(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
- Cache<Serializable, Object> cache, int historicalIndex, boolean local)
+ Cache<Serializable, Object> cache, int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.PUT, cache, historicalIndex, local);
+ super(fqn, ChangesType.PUT, cache, historicalIndex, local, useExpiration, timeOut);
this.data = data;
}
@@ -762,6 +780,11 @@
{
setCacheLocalMode();
cache.put(fqn, data);
+
+ if (useExpiration)
+ {
+ putExpiration(fqn);
+ }
}
}
@@ -775,9 +798,9 @@
private final Object value;
public PutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local)
+ int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local);
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.key = key;
this.value = value;
}
@@ -785,6 +808,11 @@
@Override
public void apply()
{
+ if (useExpiration)
+ {
+ putExpiration(fqn);
+ }
+
setCacheLocalMode();
cache.put(fqn, key, value);
}
@@ -801,9 +829,9 @@
private final Object value;
public AddToListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local)
+ int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local);
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.key = key;
this.value = value;
}
@@ -825,6 +853,12 @@
newSet.addAll((Set<Object>)existingObject);
}
newSet.add(value);
+
+ if (useExpiration)
+ {
+ putExpiration(fqn);
+ }
+
setCacheLocalMode();
cache.put(fqn, key, newSet);
}
@@ -846,9 +880,9 @@
private final Object value;
public RemoveFromListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local)
+ int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local);
+ super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.key = key;
this.value = value;
}
@@ -866,6 +900,12 @@
{
Set<Object> newSet = new HashSet<Object>((Set<Object>)existingObject);
newSet.remove(value);
+
+ if (useExpiration)
+ {
+ putExpiration(fqn);
+ }
+
setCacheLocalMode();
cache.put(fqn, key, newSet);
}
@@ -880,9 +920,9 @@
private final Serializable key;
public RemoveKeyContainer(Fqn fqn, Serializable key, Cache<Serializable, Object> cache, int historicalIndex,
- boolean local)
+ boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local);
+ super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.key = key;
}
@@ -901,9 +941,10 @@
public static class RemoveNodeContainer extends ChangesContainer
{
- public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex, boolean local)
+ public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex, boolean local,
+ boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.REMOVE, cache, historicalIndex, local);
+ super(fqn, ChangesType.REMOVE, cache, historicalIndex, local, useExpiration, timeOut);
}
@Override
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java 2010-04-15 13:54:14 UTC (rev 2283)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java 2010-04-15 15:06:48 UTC (rev 2284)
@@ -18,16 +18,16 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesType;
-import org.jboss.cache.Fqn;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesType;
+import org.jboss.cache.Fqn;
+
/**
* Sorting cache modification "as is" in {@link BufferedJBossCache} may harm data consistency.
* Here is a link, showing possible trouble:
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-04-15 13:54:14 UTC (rev 2283)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-04-15 15:06:48 UTC (rev 2284)
@@ -38,8 +38,11 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.transaction.TransactionService;
+import org.jboss.cache.Cache;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
+import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
import java.io.Serializable;
import java.util.ArrayList;
@@ -65,24 +68,24 @@
* <ul>
* <li>/$ITEMS - stores items by Id (i.e. /$ITEMS/itemId)</li>
* <li>/$CHILD_NODES, /$CHILD_PROPS - stores items by parentId and name (i.e. /$CHILD_NODES/parentId/childName.$ITEM_ID)</li>
- * <li>/$CHILD_NODES_LIST, /$CHILD_PROPS_LIST - stores child list by parentId and child Id
+ * <li>/$CHILD_NODES_LIST, /$CHILD_PROPS_LIST - stores child list by parentId and child Id
* (i.e. /$CHILD_NODES_LIST/parentId.lists = serialized Set<Object>)</li>
* </ul>
- * </li>
+ * </li>
* <li>all child properties/nodes lists should be evicted from parent at same time
* i.e. for /$CHILD_NODES_LIST, /$CHILD_PROPS_LIST we need customized eviction policy (EvictionActionPolicy) to evict
* whole list on one of childs eviction
- * </li>
+ * </li>
* </ul>
*
- * <p/>
- * Current state notes (subject of change):
+ * <p/>
+ * Current state notes (subject of change):
* <ul>
* <li>cache implements WorkspaceStorageCache, without any stuff about references and locks</li>
* <li>transaction style implemented via JBC barches, do with JTA (i.e. via exo's TransactionService + JBoss TM)</li>
* <li>we need customized eviction policy (EvictionActionPolicy) for /$CHILD_NODES_LIST, /$CHILD_PROPS_LIST</li>
* </ul>
- *
+ *
* @author <a href="mailto:peter.nedonosko at exoplatform.com">Peter Nedonosko</a>
* @version $Id: JBossCacheWorkspaceStorageCache.java 13869 2008-05-05 08:40:10Z pnedonosko $
*/
@@ -93,6 +96,10 @@
public static final String JBOSSCACHE_CONFIG = "jbosscache-configuration";
+ public static final String JBOSSCACHE_EXPIRATION = "jbosscache-expiration-time";
+
+ public static final int JBOSSCACHE_EXPIRATION_DEFAULT = 900000; // 15 minutes
+
public static final String ITEMS = "$ITEMS".intern();
public static final String CHILD_NODES = "$CHILD_NODES".intern();
@@ -253,7 +260,7 @@
*/
public JBossCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, TransactionService transactionService,
ConfigurationManager cfm) throws RepositoryException, RepositoryConfigurationException
- {
+ {
if (wsConfig.getCache() == null)
{
throw new RepositoryConfigurationException("Cache configuration not found");
@@ -271,8 +278,37 @@
factory = new ExoJBossCacheFactory<Serializable, Object>(cfm);
}
- this.cache = new BufferedJBossCache(factory.createCache(wsConfig.getCache()));
+ // create parent JBossCache instance
+ Cache<Serializable, Object> parentCache = factory.createCache(wsConfig.getCache());
+ // get all eviction configurations
+ List<EvictionRegionConfig> evictionConfigurations =
+ parentCache.getConfiguration().getEvictionConfig().getEvictionRegionConfigs();
+ // append and default eviction configuration, since it is not present in region configurations
+ evictionConfigurations.add(parentCache.getConfiguration().getEvictionConfig().getDefaultEvictionRegionConfig());
+ boolean useExpiration = false;
+ // looking over all eviction configurations till the end or till some expiration algorithm subclass not found.
+ for (EvictionRegionConfig evictionRegionConfig : evictionConfigurations)
+ {
+ if (evictionRegionConfig.getEvictionAlgorithmConfig() instanceof ExpirationAlgorithmConfig)
+ {
+ // force set expiration key to default value in all Expiration configurations (if any)
+ ((ExpirationAlgorithmConfig)evictionRegionConfig.getEvictionAlgorithmConfig())
+ .setExpirationKeyName(ExpirationAlgorithmConfig.EXPIRATION_KEY);
+ useExpiration = true;
+ }
+ }
+
+ if (useExpiration)
+ {
+ LOG.info("Using BufferedJBossCache compatible with Expiration algorithm.");
+ }
+
+ // if expiration is used, set appropriate factory with with timeout set via configuration (or default one 15minutes)
+ this.cache =
+ new BufferedJBossCache(factory.createCache(wsConfig.getCache()), useExpiration,
+ wsConfig.getCache().getParameterInteger(JBOSSCACHE_EXPIRATION, JBOSSCACHE_EXPIRATION_DEFAULT));
+
this.itemsRoot = Fqn.fromElements(ITEMS);
this.childNodes = Fqn.fromElements(CHILD_NODES);
this.childProps = Fqn.fromElements(CHILD_PROPS);
@@ -287,17 +323,17 @@
createResidentNode(childProps);
createResidentNode(childPropsList);
createResidentNode(itemsRoot);
- }
+ }
/**
* Cache constructor with JBossCache JTA transaction support.
*
- * @param wsConfig WorkspaceEntry workspace config
+ * @param wsConfig WorkspaceEntry workspace config
* @throws RepositoryException if error of initialization
* @throws RepositoryConfigurationException if error of configuration
*/
public JBossCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, ConfigurationManager cfm)
- throws RepositoryException, RepositoryConfigurationException
+ throws RepositoryException, RepositoryConfigurationException
{
this(wsConfig, null, cfm);
}
@@ -336,7 +372,7 @@
/**
* Return TransactionManager used by JBossCache backing the JCR cache.
*
- * @return TransactionManager
+ * @return TransactionManager
*/
public TransactionManager getTransactionManager()
{
@@ -406,8 +442,8 @@
{
if (state.isPersisted())
{
- // There was a problem with removing a list of samename siblings in on transaction,
- // so putItemInBufferedCache(..) and updateInBufferedCache(..) used instead put(..) and update (..) methods.
+ // There was a problem with removing a list of samename siblings in on transaction,
+ // so putItemInBufferedCache(..) and updateInBufferedCache(..) used instead put(..) and update (..) methods.
ItemData prevItem = putItemInBufferedCache(state.getData());
if (prevItem != null && state.isNode())
{
@@ -446,8 +482,8 @@
}
/**
- * {@inheritDoc}
- */
+ * {@inheritDoc}
+ */
public void addChildNodes(NodeData parent, List<NodeData> childs)
{
boolean inTransaction = cache.isTransactionActive();
@@ -541,7 +577,7 @@
// {
// cache.beginTransaction();
// cache.setLocal(true);
- //
+ //
// }
// finally
// {
@@ -632,7 +668,7 @@
/**
* Internal get child properties.
*
- * @param parentId String
+ * @param parentId String
* @param withValue boolean, if true only "full" Propeties can be returned
* @return List of PropertyData
*/
@@ -777,7 +813,7 @@
{
// add in CHILD_NODES
cache.put(makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
- .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
+ .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
// if MODIFY and List present OR FORCE_MODIFY, then write
if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childNodesList, node
.getParentIdentifier())) != null)
@@ -798,7 +834,7 @@
{
// add in CHILD_NODES
cache.put(makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
- .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
+ .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
// if MODIFY and List present OR FORCE_MODIFY, then write
if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childNodesList, node
.getParentIdentifier())) != null)
@@ -822,7 +858,7 @@
{
// add in CHILD_PROPS
cache.put(makeChildFqn(childProps, prop.getParentIdentifier(), prop.getQPath().getEntries()[prop.getQPath()
- .getEntries().length - 1]), ITEM_ID, prop.getIdentifier());
+ .getEntries().length - 1]), ITEM_ID, prop.getIdentifier());
// if MODIFY and List present OR FORCE_MODIFY, then write
if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childPropsList, prop
.getParentIdentifier())) != null)
@@ -844,7 +880,7 @@
// remove from CHILD_NODES of parent
cache.removeNode(makeChildFqn(childNodes, item.getParentIdentifier(), item.getQPath().getEntries()[item
- .getQPath().getEntries().length - 1]));
+ .getQPath().getEntries().length - 1]));
// remove from CHILD_NODES_LIST of parent
cache.removeFromList(makeChildListFqn(childNodesList, item.getParentIdentifier()), ITEM_LIST, item
@@ -867,7 +903,7 @@
{
// remove from CHILD_PROPS
cache.removeNode(makeChildFqn(childProps, item.getParentIdentifier(), item.getQPath().getEntries()[item
- .getQPath().getEntries().length - 1]));
+ .getQPath().getEntries().length - 1]));
// remove from CHILD_PROPS_LIST
cache.removeFromList(makeChildListFqn(childPropsList, item.getParentIdentifier()), ITEM_LIST, item
@@ -900,7 +936,7 @@
}
/**
- * Update Node hierachy in case of same-name siblings reorder.
+ * Update Node hierachy in case of same-name siblings reorder.
* Assumes the new (updated) nodes already putted in the cache. Previous name of updated nodes will be calculated
* and that node will be deleted (if has same id as the new node). Childs paths will be updated to a new node path.
*
@@ -912,7 +948,7 @@
// get previously cached NodeData and using its name remove child on the parent
Fqn<String> prevFqn =
makeChildFqn(childNodes, node.getParentIdentifier(), prevNode.getQPath().getEntries()[prevNode.getQPath()
- .getEntries().length - 1]);
+ .getEntries().length - 1]);
if (node.getIdentifier().equals(cache.get(prevFqn, ITEM_ID)))
{
// it's same-name siblings re-ordering, delete previous child
@@ -942,7 +978,7 @@
// get previously cached NodeData and using its name remove child on the parent
Fqn<String> prevFqn =
makeChildFqn(childNodes, node.getParentIdentifier(), prevNode.getQPath().getEntries()[prevNode.getQPath()
- .getEntries().length - 1]);
+ .getEntries().length - 1]);
if (node.getIdentifier().equals(cache.getFromBuffer(prevFqn, ITEM_ID)))
{
// it's same-name siblings re-ordering, delete previous child
@@ -978,15 +1014,15 @@
PropertyData prevProp = iter.next();
if (inheritACL
- && (prevProp.getQPath().getName().equals(Constants.EXO_PERMISSIONS) || prevProp.getQPath().getName()
- .equals(Constants.EXO_OWNER)))
+ && (prevProp.getQPath().getName().equals(Constants.EXO_PERMISSIONS) || prevProp.getQPath().getName()
+ .equals(Constants.EXO_OWNER)))
{
inheritACL = false;
}
// recreate with new path for child Props only
QPath newPath =
QPath
- .makeChildPath(rootPath, prevProp.getQPath().getEntries()[prevProp.getQPath().getEntries().length - 1]);
+ .makeChildPath(rootPath, prevProp.getQPath().getEntries()[prevProp.getQPath().getEntries().length - 1]);
TransientPropertyData newProp =
new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(), prevProp
.getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
@@ -1000,7 +1036,7 @@
// recreate with new path for child Nodes only
QPath newPath =
QPath
- .makeChildPath(rootPath, prevNode.getQPath().getEntries()[prevNode.getQPath().getEntries().length - 1]);
+ .makeChildPath(rootPath, prevNode.getQPath().getEntries()[prevNode.getQPath().getEntries().length - 1]);
TransientNodeData newNode =
new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(), prevNode
.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
@@ -1035,7 +1071,7 @@
TransientNodeData newNode =
new TransientNodeData(prevNode.getQPath(), prevNode.getIdentifier(), prevNode.getPersistedVersion(),
prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
- .getParentIdentifier(), acl);
+ .getParentIdentifier(), acl);
// update this node
cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
// update childs recursive
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/jbosscache-data.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/jbosscache-data.xml 2010-04-15 13:54:14 UTC (rev 2283)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/jbosscache-data.xml 2010-04-15 15:06:48 UTC (rev 2284)
@@ -12,11 +12,11 @@
<!-- Eviction configuration -->
<eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
+ <default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm"
actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy"
eventQueueSize="1000000">
<property name="maxNodes" value="1000000" />
- <property name="timeToLive" value="120000" />
+ <property name="warnNoExpirationKey" value="false" />
</default>
</eviction>
</jbosscache>
\ No newline at end of file
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java 2010-04-15 13:54:14 UTC (rev 2283)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java 2010-04-15 15:06:48 UTC (rev 2284)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
+import java.util.HashMap;
+
import junit.framework.TestCase;
import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
@@ -25,8 +27,6 @@
import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.RemoveNodeContainer;
import org.jboss.cache.Fqn;
-import java.util.HashMap;
-
/**
* @author <a href="mailto:foo at bar.org">Foo Bar</a>
* @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z aheritier $
@@ -40,13 +40,13 @@
CompressedChangesBuffer buffer = new CompressedChangesBuffer();
ChangesContainer put1 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
ChangesContainer put2 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
ChangesContainer rm1 =
new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"), null, buffer
- .getHistoryIndex(), false);
+ .getHistoryIndex(), false, false, 0);
buffer.add(put1);
buffer.add(put2);
assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
@@ -67,17 +67,17 @@
CompressedChangesBuffer buffer = new CompressedChangesBuffer();
ChangesContainer put1 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
ChangesContainer put2 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
ChangesContainer rm1 =
new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"), null,
- buffer.getHistoryIndex(), false);
+ buffer.getHistoryIndex(), false, false, 0);
ChangesContainer rm2 =
new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"), null, buffer
- .getHistoryIndex(), false);
+ .getHistoryIndex(), false, false, 0);
buffer.add(put1);
buffer.add(put2);
assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
@@ -97,11 +97,11 @@
CompressedChangesBuffer buffer = new CompressedChangesBuffer();
ChangesContainer put1 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES_LIST + "/b"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
ChangesContainer rm1 =
new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES_LIST + "/b"), null,
- buffer.getHistoryIndex(), false);
+ buffer.getHistoryIndex(), false, false, 0);
buffer.add(put1);
assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
buffer.add(rm1);
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml 2010-04-15 13:54:14 UTC (rev 2283)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml 2010-04-15 15:06:48 UTC (rev 2284)
@@ -11,9 +11,10 @@
<!-- Eviction configuration -->
<eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm" actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy" eventQueueSize="1000000">
- <property name="maxNodes" value="5000" />
- <property name="minTimeToLive" value="60000" />
+ <default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm" actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy"
+ eventQueueSize="1000000">
+ <property name="maxNodes" value="50000" />
+ <property name="warnNoExpirationKey" value="false" />
</default>
</eviction>
More information about the exo-jcr-commits
mailing list