[exo-jcr-commits] exo-jcr SVN: r4920 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent: jbosscache and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Sep 16 06:18:41 EDT 2011
Author: nfilotto
Date: 2011-09-16 06:18:41 -0400 (Fri, 16 Sep 2011)
New Revision: 4920
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
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/JBossCacheWorkspaceStorageCache.java
Log:
EXOJCR-1541: Bloom Filters have been disabled for JBC
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-09-16 07:50:59 UTC (rev 4919)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-09-16 10:18:41 UTC (rev 4920)
@@ -2392,7 +2392,7 @@
{
if (LOG.isDebugEnabled())
{
- LOG.debug("The method addListener is not supported", e);
+ LOG.debug("The bloom filters are disabled as they are not supported by the cache implementation " + cache.getClass().getName());
}
return;
}
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 2011-09-16 07:50:59 UTC (rev 4919)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2011-09-16 10:18:41 UTC (rev 4920)
@@ -546,30 +546,11 @@
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get(), useExpiration, expirationTimeOut, false));
+ local.get(), useExpiration, expirationTimeOut));
return parentCache.get(fqn, key);
}
-
- protected Object putWithNotification(Fqn fqn, Serializable key, Object value)
- {
- CompressedChangesBuffer changesContainer = getChangesBufferSafe();
- changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get(), useExpiration, expirationTimeOut, true));
- return parentCache.get(fqn, key);
- }
-
- protected Object putWithNotification(Fqn fqn, Serializable key, Object value, boolean putIfAbsent)
- {
- if (putIfAbsent)
- {
- putIfAbsent(fqn, key, value, true);
- return null;
- }
- return putWithNotification(fqn, key, value);
- }
-
/**
* in case putIfAbsent is set to <code>true</code> this method will
* call cache.putIfAbsent(Fqn fqn, Serializable key, Object value)
@@ -590,18 +571,13 @@
*/
protected Object putIfAbsent(Fqn fqn, Serializable key, Object value)
{
- return putIfAbsent(fqn, key, value, false);
- }
-
- protected Object putIfAbsent(Fqn fqn, Serializable key, Object value, boolean eventNotification)
- {
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new PutIfAbsentKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get(), useExpiration, expirationTimeOut, eventNotification));
+ local.get(), useExpiration, expirationTimeOut));
return null;
}
- public Object putInBuffer(Fqn fqn, Serializable key, Object value, boolean eventNotification)
+ public Object putInBuffer(Fqn fqn, Serializable key, Object value)
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
@@ -609,7 +585,7 @@
Object prevObject = getObjectFromChangesContainer(changesContainer, fqn, key);
changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get(), useExpiration, expirationTimeOut, eventNotification));
+ local.get(), useExpiration, expirationTimeOut));
if (prevObject != null)
{
@@ -715,17 +691,9 @@
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.getHistoryIndex(), local.get(),
- useExpiration, expirationTimeOut, false));
+ useExpiration, expirationTimeOut));
return true;
}
-
- protected boolean removeNode(Fqn fqn, boolean eventNotification)
- {
- CompressedChangesBuffer changesContainer = getChangesBufferSafe();
- changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.getHistoryIndex(), local.get(),
- useExpiration, expirationTimeOut, eventNotification));
- return true;
- }
/* (non-Javadoc)
* @see org.jboss.cache.Cache#removeNode(java.lang.String)
@@ -861,11 +829,9 @@
protected final boolean useExpiration;
protected final long timeOut;
-
- protected final boolean eventNotification;
public ChangesContainer(Fqn fqn, ChangesType changesType, Cache<Serializable, Object> cache, int historicalIndex,
- boolean localMode, boolean useExpiration, long timeOut, boolean eventNotification)
+ boolean localMode, boolean useExpiration, long timeOut)
{
super();
this.fqn = fqn;
@@ -875,7 +841,6 @@
this.localMode = localMode;
this.useExpiration = useExpiration;
this.timeOut = timeOut;
- this.eventNotification = eventNotification;
}
/**
@@ -917,16 +882,14 @@
return result == 0 ? historicalIndex - o.getHistoricalIndex() : result;
}
- protected void setOptionOverrides()
+ protected void setCacheLocalMode()
{
cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(localMode);
- cache.getInvocationContext().getOptionOverrides().setSuppressEventNotification(!eventNotification);
}
public final void putExpiration(Fqn efqn)
{
- cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(localMode);
- cache.getInvocationContext().getOptionOverrides().setSuppressEventNotification(true);
+ setCacheLocalMode();
cache.put(efqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + timeOut));
}
@@ -948,7 +911,7 @@
public PutObjectContainer(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
Cache<Serializable, Object> cache, int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.PUT, cache, historicalIndex, local, useExpiration, timeOut, false);
+ super(fqn, ChangesType.PUT, cache, historicalIndex, local, useExpiration, timeOut);
this.data = data;
}
@@ -961,7 +924,7 @@
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(fqn, data);
}
}
@@ -976,9 +939,9 @@
private final Object value;
public PutIfAbsentKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local, boolean useExpiration, long timeOut, boolean eventNotification)
+ int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut, eventNotification);
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.key = key;
this.value = value;
}
@@ -997,7 +960,7 @@
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(fqn, key, value);
}
@@ -1018,9 +981,9 @@
private final Object value;
public PutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local, boolean useExpiration, long timeOut, boolean eventNotification)
+ int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut, eventNotification);
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.key = key;
this.value = value;
}
@@ -1033,7 +996,7 @@
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(fqn, key, value);
}
}
@@ -1053,7 +1016,7 @@
public AddToListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
boolean forceModify, int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut, false);
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.key = key;
this.value = value;
this.forceModify = forceModify;
@@ -1082,7 +1045,7 @@
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(fqn, key, newSet);
}
else if (existingObject != null)
@@ -1095,7 +1058,6 @@
{
// to prevent consistency issue since we don't have the list in the local cache, we are in cluster env
// and we are in a non local mode, we clear the list in order to enforce other cluster nodes to reload it from the db
- setOptionOverrides();
cache.put(fqn, key, null);
}
}
@@ -1121,7 +1083,7 @@
public AddToPatternListContainer(Fqn fqn, Serializable patternKey, Serializable listKey, ItemData value,
Cache<Serializable, Object> cache, int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut, false);
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.patternKey = patternKey;
this.listKey = listKey;
this.value = value;
@@ -1134,7 +1096,6 @@
{
// to prevent consistency issue since we don't have the list in the local cache, we are in cluster env
// and we are in a non local mode, we remove all the patterns in order to enforce other cluster nodes to reload them from the db
- setOptionOverrides();
cache.removeNode(fqn);
return;
}
@@ -1165,14 +1126,14 @@
continue;
}
Set<String> newSet = new HashSet<String>((Set<String>)setObject);
- newSet.add(value.getIdentifier());
+ newSet.add(value.getIdentifier());
if (useExpiration)
{
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(patternFqn, listKey, newSet);
}
}
@@ -1197,7 +1158,7 @@
public RemoveFromListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut, false);
+ super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.key = key;
this.value = value;
}
@@ -1219,7 +1180,7 @@
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(fqn, key, newSet);
}
}
@@ -1245,7 +1206,7 @@
public RemoveFromPatternListContainer(Fqn fqn, Serializable patternKey, Serializable listKey, ItemData value,
Cache<Serializable, Object> cache, int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut, false);
+ super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.patternKey = patternKey;
this.listKey = listKey;
this.value = value;
@@ -1287,7 +1248,7 @@
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(patternFqn, listKey, newSet);
}
}
@@ -1310,14 +1271,14 @@
public RemoveKeyContainer(Fqn fqn, Serializable key, Cache<Serializable, Object> cache, int historicalIndex,
boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut, false);
+ super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.key = key;
}
@Override
public void apply()
{
- setOptionOverrides();
+ setCacheLocalMode();
cache.remove(fqn, key);
}
@@ -1332,19 +1293,13 @@
public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex, boolean local,
boolean useExpiration, long timeOut)
{
- this(fqn, cache, historicalIndex, local, useExpiration, timeOut, false);
+ super(fqn, ChangesType.REMOVE, cache, historicalIndex, local, useExpiration, timeOut);
}
- public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex, boolean local,
- boolean useExpiration, long timeOut, boolean eventNotification)
- {
- super(fqn, ChangesType.REMOVE, cache, historicalIndex, local, useExpiration, timeOut, eventNotification);
- }
-
@Override
public void apply()
{
- setOptionOverrides();
+ setCacheLocalMode();
cache.removeNode(fqn);
}
}
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 2011-09-16 07:50:59 UTC (rev 4919)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-09-16 10:18:41 UTC (rev 4920)
@@ -60,12 +60,10 @@
import org.jboss.cache.CacheStatus;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
-import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.config.Configuration.CacheMode;
+import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
import org.jboss.cache.jmx.JmxRegistrationManager;
-import org.jboss.cache.notifications.annotation.NodeModified;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.picocontainer.Startable;
import java.io.File;
@@ -82,7 +80,6 @@
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
@@ -191,12 +188,7 @@
protected final Fqn<String> childNodesByPatternList;
protected final Fqn<String> rootFqn;
-
- /**
- * The list of all the listeners
- */
- private final List<WorkspaceStorageCacheListener> listeners = new CopyOnWriteArrayList<WorkspaceStorageCacheListener>();
-
+
private final CacheActionNonTxAware<Void, Void> commitTransaction = new CacheActionNonTxAware<Void, Void>()
{
@Override
@@ -690,8 +682,7 @@
createResidentNode(childPropsByPatternList);
createResidentNode(childNodesByPatternList);
createResidentNode(itemsRoot);
- this.cache.addCacheListener(new CacheEventListener());
-
+
if (jmxManager != null)
{
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
@@ -744,7 +735,6 @@
if (!cacheRoot.hasChild(fqn))
{
cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
- cache.getInvocationContext().getOptionOverrides().setSuppressEventNotification(true);
cacheRoot.addChild(fqn).setResident(true);
}
else
@@ -1513,8 +1503,8 @@
}
// add in ITEMS
- return (ItemData)cache.putWithNotification(makeItemFqn(node.getIdentifier()), ITEM_DATA, node,
- modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
+ return (ItemData) cache.put(makeItemFqn(node.getIdentifier()), ITEM_DATA, node,
+ modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
}
/**
@@ -1582,8 +1572,7 @@
}
// add in ITEMS
// NullNodeData must never be returned inside internal cache operations.
- ItemData returnedData =
- (ItemData)cache.putInBuffer(makeItemFqn(node.getIdentifier()), ITEM_DATA, node, modifyListsOfChild != ModifyChildOption.NOT_MODIFY);
+ ItemData returnedData = (ItemData)cache.putInBuffer(makeItemFqn(node.getIdentifier()), ITEM_DATA, node);
return (returnedData instanceof NullItemData) ? null : returnedData;
}
@@ -1636,8 +1625,8 @@
// add in ITEMS
// NullItemData must never be returned inside internal cache operations.
ItemData returnedData =
- (ItemData)cache.putWithNotification(makeItemFqn(prop.getIdentifier()), ITEM_DATA, prop,
- modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
+ (ItemData) cache.put(makeItemFqn(prop.getIdentifier()), ITEM_DATA, prop,
+ modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
return (returnedData instanceof NullItemData) ? null : (PropertyData) returnedData;
}
@@ -1703,7 +1692,7 @@
}
// remove from ITEMS
- cache.removeNode(makeItemFqn(item.getIdentifier()), true);
+ cache.removeNode(makeItemFqn(item.getIdentifier()));
}
/**
@@ -1713,7 +1702,7 @@
*/
protected void updateMixin(NodeData node)
{
- NodeData prevData = (NodeData)cache.putWithNotification(makeItemFqn(node.getIdentifier()), ITEM_DATA, node);
+ NodeData prevData = (NodeData)cache.put(makeItemFqn(node.getIdentifier()), ITEM_DATA, node);
// prevent update NullNodeData
if (prevData != null && !(prevData instanceof NullItemData))
{
@@ -1845,7 +1834,7 @@
.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
.getParentIdentifier(), inheritACL ? acl : prevNode.getACL()); // TODO check ACL
// update this node
- cache.putWithNotification(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
+ cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
}
else
{
@@ -1863,7 +1852,7 @@
TransientPropertyData newProp =
new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(), prevProp
.getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
- cache.putWithNotification(makeItemFqn(newProp.getIdentifier()), ITEM_DATA, newProp);
+ cache.put(makeItemFqn(newProp.getIdentifier()), ITEM_DATA, newProp);
}
}
}
@@ -1898,7 +1887,7 @@
TransientPropertyData newProp =
new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(), prevProp
.getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
- cache.putWithNotification(makeItemFqn(newProp.getIdentifier()), ITEM_DATA, newProp);
+ cache.put(makeItemFqn(newProp.getIdentifier()), ITEM_DATA, newProp);
}
// update child nodes
@@ -1914,7 +1903,7 @@
.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
.getParentIdentifier(), inheritACL ? acl : prevNode.getACL()); // TODO check ACL
// update this node
- cache.putWithNotification(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
+ cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
// update childs recursive
updateTreePath(newNode.getIdentifier(), newNode.getQPath(), inheritACL ? acl : null);
}
@@ -1945,7 +1934,7 @@
prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
.getParentIdentifier(), acl);
// update this node
- cache.putWithNotification(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
+ cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
// update childs recursive
updateChildsACL(newNode.getIdentifier(), acl);
}
@@ -2097,7 +2086,9 @@
*/
public void addListener(WorkspaceStorageCacheListener listener)
{
- listeners.add(listener);
+ // As the listeners in JBC really slow down the whole application, we decided to disable
+ // the bloom filters in case of JBC
+ throw new UnsupportedOperationException("The cache listeners are not supported by the LinkedWorkspaceStorageCacheImpl");
}
/**
@@ -2105,33 +2096,12 @@
*/
public void removeListener(WorkspaceStorageCacheListener listener)
{
- listeners.remove(listener);
+ // As the listeners in JBC really slow down the whole application, we decided to disable
+ // the bloom filters in case of JBC
+ throw new UnsupportedOperationException("The cache listeners are not supported by the LinkedWorkspaceStorageCacheImpl");
}
/**
- * Called when a cache entry corresponding to the given node has item updated
- * @param data the item corresponding to the updated cache entry
- */
- private void onCacheEntryUpdated(ItemData data)
- {
- if (data == null || data instanceof NullItemData)
- {
- return;
- }
- for (WorkspaceStorageCacheListener listener : listeners)
- {
- try
- {
- listener.onCacheEntryUpdated(data);
- }
- catch (Exception e)
- {
- LOG.warn("The method onCacheEntryUpdated fails for the listener " + listener.getClass(), e);
- }
- }
- }
-
- /**
* Actions that are not supposed to be called within a transaction
*
* Created by The eXo Platform SAS
@@ -2149,20 +2119,4 @@
return JBossCacheWorkspaceStorageCache.this.getTransactionManager();
}
}
-
- @org.jboss.cache.notifications.annotation.CacheListener
- @SuppressWarnings("unchecked")
- public class CacheEventListener
- {
-
- @NodeModified
- public void nodeModified(NodeModifiedEvent ne)
- {
- if (!ne.isPre() && ne.getFqn().isChildOf(itemsRoot))
- {
- final Map<Serializable, Object> data = ne.getData();
- onCacheEntryUpdated((ItemData)(data == null ? null : data.get(ITEM_DATA)));
- }
- }
- }
}
More information about the exo-jcr-commits
mailing list