Author: tolusha
Date: 2010-09-10 06:51:52 -0400 (Fri, 10 Sep 2010)
New Revision: 3102
Modified:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
Log:
EXOJCR-830: code review
Modified:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java
===================================================================
---
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java 2010-09-10
09:38:16 UTC (rev 3101)
+++
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java 2010-09-10
10:51:52 UTC (rev 3102)
@@ -711,10 +711,14 @@
}
/**
+ * Put object in cache.
*
* @param key
+ * cache key
* @param value
+ * cache value
* @return
+ * always returns null
*/
public Object put(CacheKey key, Object value)
{
@@ -722,7 +726,7 @@
changesContainer.add(new PutObjectContainer(key, value, parentCache,
changesContainer.getHistoryIndex(), local
.get(), allowLocalChanges));
- return parentCache.get(key);
+ return null;
}
/**
@@ -749,7 +753,9 @@
CompressedISPNChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new RemoveObjectContainer((CacheKey)key, parentCache,
changesContainer.getHistoryIndex(),
local.get(), allowLocalChanges));
- return parentCache.get(key);
+
+ // return null as we never used result
+ return null;
}
/**
Modified:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
===================================================================
---
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2010-09-10
09:38:16 UTC (rev 3101)
+++
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2010-09-10
10:51:52 UTC (rev 3102)
@@ -590,6 +590,8 @@
{
if (node.getParentIdentifier() != null)
{
+ cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath()),
node.getIdentifier());
+
// if MODIFY and List present OR FORCE_MODIFY, then write
if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.get(new
CacheNodesId(node.getParentIdentifier())) != null)
|| modifyListsOfChild == ModifyChildOption.FORCE_MODIFY)
@@ -598,7 +600,6 @@
}
}
- cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath()),
node.getIdentifier());
return (ItemData)cache.put(new CacheId(node.getIdentifier()), node);
}
@@ -606,6 +607,8 @@
{
if (node.getParentIdentifier() != null)
{
+ cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath()),
node.getIdentifier());
+
// if MODIFY and List present OR FORCE_MODIFY, then write
if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.get(new
CacheNodesId(node.getParentIdentifier())) != null)
|| modifyListsOfChild == ModifyChildOption.FORCE_MODIFY)
@@ -614,7 +617,6 @@
}
}
- cache.putInBuffer(new CacheQPath(node.getParentIdentifier(), node.getQPath()),
node.getIdentifier());
return (ItemData)cache.putInBuffer(new CacheId(node.getIdentifier()), node);
}
@@ -641,13 +643,14 @@
{
cache.remove(new CacheId(item.getIdentifier()));
cache.remove(new CacheQPath(item.getParentIdentifier(), item.getQPath()));
- cache.remove(new CacheNodesId(item.getIdentifier()));
- cache.remove(new CachePropsId(item.getIdentifier()));
if (item.getParentIdentifier() != null)
{
if (item.isNode())
{
+ cache.remove(new CacheNodesId(item.getIdentifier()));
+ cache.remove(new CachePropsId(item.getIdentifier()));
+
cache.removeFromList(new CacheNodesId(item.getParentIdentifier()),
item.getIdentifier());
}
else
@@ -693,10 +696,7 @@
CacheQPath prevKey = new CacheQPath(node.getParentIdentifier(),
prevNode.getQPath());
if (node.getIdentifier().equals(cache.getFromBuffer(prevKey)))
{
- if (cache.remove(new CacheQPath(prevNode.getParentIdentifier(),
prevNode.getQPath())) != null)
- {
- LOG.debug("Node not extists as a child but update asked " +
node.getQPath().getAsString());
- }
+ cache.remove(prevKey);
}
// update childs paths if index changed