Author: manik.surtani(a)jboss.com
Date: 2009-02-24 10:42:55 -0500 (Tue, 24 Feb 2009)
New Revision: 7774
Modified:
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
Log:
Better sanity check
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2009-02-24 15:26:32 UTC
(rev 7773)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2009-02-24 15:42:55 UTC
(rev 7774)
@@ -63,6 +63,7 @@
import org.jgroups.blocks.GroupRequest;
import org.jgroups.blocks.RspFilter;
import org.jgroups.protocols.TP;
+import org.jgroups.protocols.pbcast.STREAMING_STATE_TRANSFER;
import org.jgroups.stack.ProtocolStack;
import org.jgroups.util.Rsp;
import org.jgroups.util.RspList;
@@ -321,7 +322,7 @@
sanityCheckConfiguration(nonBlocking, fetchState);
this.flushTracker = nonBlocking ? new NonBlockingFlushTracker() : new
StandardFlushTracker();
- initialiseChannelAndRpcDispatcher(fetchState && !nonBlocking);
+ initialiseChannelAndRpcDispatcher(fetchState && !nonBlocking,
nonBlocking);
if (!fetchState || nonBlocking)
{
@@ -387,10 +388,6 @@
if (isUsingBuddyReplication)
throw new ConfigurationException("Non-blocking state transfer cannot be
used with buddy replication at this time. Please disable either buddy replication or
non-blocking state transfer.");
-
- // Make sure Streaming state transfer is enabled in JGroups!
- if
(!configuration.getClusterConfig().contains("STREAMING_STATE_TRANSFER"))
- throw new ConfigurationException("Non-blocking state transfer requires the
STREAMING_STATE_TRANSFER protocol in JGroups. Please make sure this is available, or else
disable non-blocking state transfer.");
}
private void startNonBlockStateTransfer(List<Address> members)
@@ -501,7 +498,7 @@
}
@SuppressWarnings("deprecation")
- private void initialiseChannelAndRpcDispatcher(boolean fetchState) throws
CacheException
+ private void initialiseChannelAndRpcDispatcher(boolean fetchStateWithoutNBST, boolean
nbst) throws CacheException
{
channel = configuration.getRuntimeConfig().getChannel();
if (channel == null)
@@ -545,11 +542,15 @@
configuration.getRuntimeConfig().setChannel(channel);
}
+
+ if (nbst && ((JChannel)
channel).getProtocolStack().findProtocol(STREAMING_STATE_TRANSFER.class) == null)
+ throw new ConfigurationException("JGroups channel does not use
STREAMING_STATE_TRANSFER! This is a requirement for non-blocking state transfer. Either
make sure your JGroups configuration uses STREAMING_STATE_TRANSFER or disable non-blocking
state transfer.");
+
// Channel.LOCAL *must* be set to false so we don't see our own messages -
otherwise invalidations targeted at
// remote instances will be received by self.
channel.setOpt(Channel.LOCAL, false);
channel.setOpt(Channel.AUTO_RECONNECT, true);
- channel.setOpt(Channel.AUTO_GETSTATE, fetchState);
+ channel.setOpt(Channel.AUTO_GETSTATE, fetchStateWithoutNBST);
channel.setOpt(Channel.BLOCK, true);
if (configuration.isUseRegionBasedMarshalling())
Show replies by date