Author: nzamosenchuk
Date: 2011-02-08 07:25:05 -0500 (Tue, 08 Feb 2011)
New Revision: 3941
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ParentNodeEvictionActionPolicy.java
Log:
EXOJCR-1185 : applying the patch, that replaces getChildrenNamesDirect with
hasChildrenDirect
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ParentNodeEvictionActionPolicy.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ParentNodeEvictionActionPolicy.java 2011-02-08
10:17:33 UTC (rev 3940)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ParentNodeEvictionActionPolicy.java 2011-02-08
12:25:05 UTC (rev 3941)
@@ -24,8 +24,6 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.eviction.EvictionActionPolicy;
-import java.util.Set;
-
/**
* This class is used to prevent the memory leak described here
http://community.jboss.org/thread/147084
* and corresponding to the JIRA
https://jira.jboss.org/jira/browse/JBCACHE-1567
@@ -53,14 +51,18 @@
try
{
if (log.isTraceEnabled())
+ {
log.trace("Evicting Fqn " + fqn);
+ }
cache.evict(fqn);
result = true;
}
catch (Exception e)
{
if (log.isDebugEnabled())
+ {
log.debug("Unable to evict " + fqn, e);
+ }
result = false;
}
if (fqn.size() != 4)
@@ -76,26 +78,26 @@
// The expected data structure is of type
${ws-id}/$CHILD_NODES/${node-id}/${sub-node-name} or
// ${ws-id}/$CHILD_PROPS/${node-id}/${sub-property-name}
- // We use the method getChildrenNamesDirect to avoid going through
+ // We use the method hasChildrenDirect to avoid going through
// the intercepter chain (EXOJCR-460)
NodeSPI node = ((CacheSPI)cache).peek(parentFqn, false);
// Check if not null, possibly this node was concurrently removed
- if (node != null)
+ if (node != null && !node.hasChildrenDirect())
{
- Set<Object> names = node.getChildrenNamesDirect();
- if (names.isEmpty() || (names.size() == 1 &&
names.contains(fqn.get(3))))
+ if (log.isTraceEnabled())
{
- if (log.isTraceEnabled())
- log.trace("Evicting Fqn " + fqn);
- cache.evict(parentFqn);
+ log.trace("Evicting Fqn " + fqn);
}
+ cache.evict(parentFqn);
}
}
}
catch (Exception e)
{
if (log.isDebugEnabled())
+ {
log.debug("Unable to evict " + fqn, e);
+ }
}
return result;
}