[jboss-cvs] JBossCache/src/org/jboss/cache ...
Manik Surtani
manik at jboss.org
Sat Mar 17 15:11:03 EDT 2007
User: msurtani
Date: 07/03/17 15:11:03
Modified: src/org/jboss/cache CacheImpl.java
Log:
Ported fixes relating to releasing 1.4.1.SP3 to HEAD.
Revision Changes Path
1.54 +99 -31 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.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- CacheImpl.java 16 Mar 2007 17:48:17 -0000 1.53
+++ CacheImpl.java 17 Mar 2007 19:11:03 -0000 1.54
@@ -15,6 +15,7 @@
import org.jboss.cache.config.BuddyReplicationConfig;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.jboss.cache.config.Option;
import org.jboss.cache.config.RuntimeConfig;
import org.jboss.cache.factories.InterceptorChainFactory;
import org.jboss.cache.interceptors.Interceptor;
@@ -1492,8 +1493,11 @@
if (fqn.isRoot())
{
boolean result = true;
- for (Object childName : getChildrenNames(fqn))
+ // we need to preserve options
+ Option o = getInvocationContext().getOptionOverrides();
+ for (Object childName : _getChildrenNames(fqn))
{
+ getInvocationContext().setOptionOverrides(o);
result = remove(new Fqn(fqn, childName)) && result;
}
@@ -1519,9 +1523,23 @@
*/
public void evict(Fqn fqn) throws CacheException
{
+ if (fqn.isRoot())
+ {
+ // special treatment for root eviction
+ // we need to preserve options
+ Option o = getInvocationContext().getOptionOverrides();
+ for (Object childName : _getChildrenNames(fqn))
+ {
+ getInvocationContext().setOptionOverrides(o);
+ evict(new Fqn(fqn, childName));
+ }
+ }
+ else
+ {
MethodCall m = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, fqn);
invokeMethod(m);
}
+ }
/**
* Removes <code>key</code> from the node's hashmap
@@ -2655,7 +2673,7 @@
}
catch (Exception ex)
{
- log.warn("replication failure with method_call " + method_call + " exception: " + ex);
+ log.warn("replication failure with method_call " + method_call + " exception", ex);
throw ex;
}
finally
@@ -2735,6 +2753,10 @@
// for now, perform a very simple series of getData calls.
+ try
+ {
+ getInvocationContext().setOriginLocal(false);
+
NodeSPI actualNode = findNode(fqn);
Fqn backupNodeFqn = null;
if (actualNode == null && searchSubtrees)
@@ -2770,6 +2792,11 @@
GravitateResult gr = GravitateResult.subtreeResult(list, backupNodeFqn);
return gr;
}
+ finally
+ {
+ getInvocationContext().setOriginLocal(true);
+ }
+ }
private List<NodeData> getNodeData(List<NodeData> list, NodeSPI<K, V> node)
{
@@ -2786,18 +2813,55 @@
public void _remoteAssignToBuddyGroup(BuddyGroup group, Map<Fqn, byte[]> state) throws Exception
{
+ try
+ {
+ // these are remote calls and as such, should have their origins marked as remote.
+ getInvocationContext().setOriginLocal(false);
if (buddyManager != null)
buddyManager.handleAssignToBuddyGroup(group, state);
+ else if (log.isWarnEnabled())
+ log.warn("Received assignToBuddyGroup call from group owner [" + group.getDataOwner() + "] but buddy replication is not enabled on this node!");
+ }
+ finally
+ {
+ getInvocationContext().setOriginLocal(true);
+ }
+
}
public void _remoteRemoveFromBuddyGroup(String groupName) throws BuddyNotInitException
{
- if (buddyManager != null) buddyManager.handleRemoveFromBuddyGroup(groupName);
+ try
+ {
+ // these are remote calls and as such, should have their origins marked as remote.
+ getInvocationContext().setOriginLocal(false);
+ if (buddyManager != null)
+ buddyManager.handleRemoveFromBuddyGroup(groupName);
+ else if (log.isWarnEnabled())
+ log.warn("Received removeFromBuddyGroup call for group name [" + groupName + "] but buddy replication is not enabled on this node!");
+ }
+ finally
+ {
+ getInvocationContext().setOriginLocal(true);
+ }
+
}
public void _remoteAnnounceBuddyPoolName(IpAddress address, String buddyPoolName)
{
- if (buddyManager != null) buddyManager.handlePoolNameBroadcast(address, buddyPoolName);
+ try
+ {
+ // these are remote calls and as such, should have their origins marked as remote.
+ getInvocationContext().setOriginLocal(false);
+ if (buddyManager != null)
+ buddyManager.handlePoolNameBroadcast(address, buddyPoolName);
+ else if (log.isWarnEnabled())
+ log.warn("Received annouceBuddyPoolName call from [" + address + "] but buddy replication is not enabled on this node!");
+ }
+ finally
+ {
+ getInvocationContext().setOriginLocal(true);
+ }
}
public void _dataGravitationCleanup(GlobalTransaction gtx, Fqn primary, Fqn backup) throws Exception
@@ -2805,11 +2869,15 @@
MethodCall primaryDataCleanup, backupDataCleanup;
if (buddyManager.isDataGravitationRemoveOnFind())
{
+ if (log.isTraceEnabled())
+ log.trace("DataGravitationCleanup: Removing primary (" + primary + ") and backup (" + backup + ")");
primaryDataCleanup = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, null, primary, false);
backupDataCleanup = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, null, backup, false);
}
else
{
+ if (log.isTraceEnabled())
+ log.trace("DataGravitationCleanup: Evicting primary (" + primary + ") and backup (" + backup + ")");
primaryDataCleanup = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, primary);
backupDataCleanup = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, backup);
}
More information about the jboss-cvs-commits
mailing list