Author: tolusha
Date: 2011-09-16 07:20:28 -0400 (Fri, 16 Sep 2011)
New Revision: 4924
Modified:
jcr/branches/1.14.0-GA-CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/branches/1.14.0-GA-CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
jcr/branches/1.14.0-GA-CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
Log:
disable bloom filter by default
Modified:
jcr/branches/1.14.0-GA-CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
---
jcr/branches/1.14.0-GA-CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-09-16
10:35:47 UTC (rev 4923)
+++
jcr/branches/1.14.0-GA-CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-09-16
11:20:28 UTC (rev 4924)
@@ -2342,7 +2342,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/branches/1.14.0-GA-CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
===================================================================
---
jcr/branches/1.14.0-GA-CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2011-09-16
10:35:47 UTC (rev 4923)
+++
jcr/branches/1.14.0-GA-CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2011-09-16
11:20:28 UTC (rev 4924)
@@ -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)
@@ -1094,7 +1057,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);
}
}
@@ -1120,7 +1082,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;
@@ -1133,7 +1095,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;
}
@@ -1164,14 +1125,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);
}
}
@@ -1196,7 +1157,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;
}
@@ -1218,7 +1179,7 @@
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(fqn, key, newSet);
}
}
@@ -1244,7 +1205,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;
@@ -1286,7 +1247,7 @@
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(patternFqn, listKey, newSet);
}
}
@@ -1309,14 +1270,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);
}
@@ -1331,19 +1292,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/branches/1.14.0-GA-CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
---
jcr/branches/1.14.0-GA-CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-09-16
10:35:47 UTC (rev 4923)
+++
jcr/branches/1.14.0-GA-CP01/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-09-16
11:20:28 UTC (rev 4924)
@@ -63,8 +63,6 @@
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;
@@ -81,7 +79,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;
@@ -190,12 +187,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
@@ -689,8 +681,7 @@
createResidentNode(childPropsByPatternList);
createResidentNode(childNodesByPatternList);
createResidentNode(itemsRoot);
- this.cache.addCacheListener(new CacheEventListener());
-
+
if (jmxManager != null)
{
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
@@ -743,7 +734,6 @@
if (!cacheRoot.hasChild(fqn))
{
cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
-
cache.getInvocationContext().getOptionOverrides().setSuppressEventNotification(true);
cacheRoot.addChild(fqn).setResident(true);
}
else
@@ -1512,8 +1502,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);
}
/**
@@ -1581,8 +1571,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;
}
@@ -1635,8 +1624,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;
}
@@ -1702,7 +1691,7 @@
}
// remove from ITEMS
- cache.removeNode(makeItemFqn(item.getIdentifier()), true);
+ cache.removeNode(makeItemFqn(item.getIdentifier()));
}
/**
@@ -1712,7 +1701,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))
{
@@ -1844,7 +1833,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
{
@@ -1862,7 +1851,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);
}
}
}
@@ -1897,7 +1886,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
@@ -1913,7 +1902,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);
}
@@ -1944,7 +1933,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);
}
@@ -2096,7 +2085,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");
}
/**
@@ -2104,33 +2095,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
@@ -2148,20 +2118,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)));
- }
- }
- }
}