[jboss-cvs] JBossCache/src/org/jboss/cache ...
Manik Surtani
msurtani at jboss.com
Mon Mar 5 14:15:56 EST 2007
User: msurtani
Date: 07/03/05 14:15:56
Modified: src/org/jboss/cache CacheImpl.java
Log:
JBCACHE-999
Revision Changes Path
1.50 +30 -45 JBossCache/src/org/jboss/cache/CacheImpl.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheImpl.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/CacheImpl.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- CacheImpl.java 27 Feb 2007 17:39:53 -0000 1.49
+++ CacheImpl.java 5 Mar 2007 19:15:56 -0000 1.50
@@ -14,8 +14,8 @@
import org.jboss.cache.buddyreplication.GravitateResult;
import org.jboss.cache.config.BuddyReplicationConfig;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.RuntimeConfig;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.jboss.cache.config.RuntimeConfig;
import org.jboss.cache.factories.InterceptorChainFactory;
import org.jboss.cache.interceptors.Interceptor;
import org.jboss.cache.jmx.CacheJmxWrapper;
@@ -1459,10 +1459,23 @@
public boolean remove(Fqn fqn) throws CacheException
{
GlobalTransaction tx = getCurrentTransaction();
+ // special case if we are removing the root. Remove all children instead.
+ if (fqn.isRoot())
+ {
+ boolean result = true;
+ for (Object childName : getChildrenNames(fqn))
+ {
+ result = remove(new Fqn(fqn, childName)) && result;
+ }
+
+ return result;
+ }
+ else
+ {
MethodCall m = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, tx, fqn, true);
Object retval = invokeMethod(m);
- if (retval == null) return false;
- return (Boolean) retval;
+ return retval != null && (Boolean) retval;
+ }
}
/**
@@ -2230,30 +2243,6 @@
}
}
- if (fqn.size() == 0)
- {
- Set children = getChildrenNames(fqn);
- if (children != null)
- {
- Object[] kids = children.toArray();
-
- for (int i = 0; i < kids.length; i++)
- {
- Object s = kids[i];
- Fqn tmp = new Fqn(fqn, s);
- try
- {
- return _remove(tx, tmp, create_undo_ops, true, eviction);
- }
- catch (Exception e)
- {
- log.error("failure removing node " + tmp);
- return false;
- }
- }
- }
- }
-
// Find the node. This will add the temporarily created parent nodes to the TX's node list if tx != null)
n = findNode(fqn, version);
if (n == null)
@@ -2493,11 +2482,9 @@
* Internal evict method called by eviction policy provider.
*
* @param fqn removes everything assoicated with this FQN
- *
* @return <code>true</code> if the node has been completely removed,
* <code>false</code> if only the data map was removed, due
* to the presence of children
- *
* @throws CacheException
*/
public boolean _evict(Fqn fqn) throws CacheException
@@ -2529,11 +2516,9 @@
*
* @param fqn
* @param version
- *
* @return <code>true</code> if the node has been completely removed,
* <code>false</code> if only the data map was removed, due
* to the presence of children
- *
* @throws CacheException
*/
public boolean _evict(Fqn fqn, DataVersion version) throws CacheException
@@ -3748,7 +3733,7 @@
if (n.getFqn().isRoot())
{
// do not actually delete; just remove deletion marker
- n.markAsDeleted(false);
+ n.markAsDeleted(true);
// but now remove all children, since the call has been to remove("/")
n.removeChildrenDirect();
return true;
More information about the jboss-cvs-commits
mailing list