[jboss-cvs] JBoss Messaging SVN: r1753 - in branches/Branch_Client_Failover_Experiment: src/main/org/jboss/jms/client/container src/main/org/jboss/jms/client/delegate src/main/org/jboss/jms/server src/main/org/jboss/jms/server/endpoint src/main/org/jboss/jms/server/endpoint/advised src/main/org/jboss/messaging/core/plugin/postoffice/cluster tests/src/org/jboss/test/messaging/jms/clustering
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Dec 10 07:38:07 EST 2006
Author: timfox
Date: 2006-12-10 07:37:08 -0500 (Sun, 10 Dec 2006)
New Revision: 1753
Modified:
branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/HAAspect.java
branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java
branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java
branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/advised/ConnectionFactoryAdvised.java
branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java
branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java
Log:
Server side valve
Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/HAAspect.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/HAAspect.java 2006-12-10 12:14:05 UTC (rev 1752)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/HAAspect.java 2006-12-10 12:37:08 UTC (rev 1753)
@@ -26,10 +26,11 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+
import javax.jms.JMSException;
+
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aop.metadata.SimpleMetaData;
import org.jboss.jms.client.delegate.ClientBrowserDelegate;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate;
@@ -47,6 +48,7 @@
import org.jboss.jms.client.state.ProducerState;
import org.jboss.jms.client.state.SessionState;
import org.jboss.jms.destination.JBossDestination;
+import org.jboss.jms.server.endpoint.ConnectionStatus;
import org.jboss.logging.Logger;
import org.jboss.remoting.Client;
import org.jboss.remoting.ConnectionListener;
@@ -67,7 +69,7 @@
*/
public class HAAspect
{
- private static final Logger log = Logger.getLogger(ConnectionAspect.class);
+ private static final Logger log = Logger.getLogger(HAAspect.class);
private static boolean trace = log.isTraceEnabled();
@@ -161,8 +163,16 @@
throws Exception
{
log.info("createConnection");
- ClientConnectionDelegate connDelegate = (ClientConnectionDelegate)cf.createConnectionDelegate(username, password);
+ ClientConnectionDelegate connDelegate =
+ (ClientConnectionDelegate)cf.createConnectionDelegate(username, password);
+ initialiseConnection(connDelegate);
+
+ return connDelegate;
+ }
+
+ private void initialiseConnection(ClientConnectionDelegate connDelegate)
+ {
//Add a connection listener
ConnectionState state = (ConnectionState)((DelegateSupport)connDelegate).getState();
@@ -170,8 +180,6 @@
ConnectionListener listener = new Listener(connDelegate);
state.getRemotingConnection().getInvokingClient().addConnectionListener(listener);
-
- return connDelegate;
}
@@ -186,27 +194,46 @@
ConnectionState state = (ConnectionState)((DelegateSupport)failedConnection).getState();
- log.info("*** about to failover - waiting for server to finish");
+ log.info("Failing over connection");
- //FIXME - this is only temporarily necessary since we need to give the server enough time to
- //failover before we reconnect - this would be handled by the server side valve
- Thread.sleep(10000);
-
- log.info("Creating new connection");
- ClientConnectionDelegate newConnection = createConnection(newCF, state.getUser(), state.getPassword());
- log.info("Created new connection");
+ ConnectionStatus status =
+ newCF.createFailoverConnectionDelegate(state.getUser(), state.getPassword(), state.getServerID());
-// try
-// {
+ log.info("returned from createFailoverConnectionDelegate");
+
+ if (status.getDelegate() != null)
+ {
+ log.info("Got connection");
+
+ ClientConnectionDelegate newConnection = (ClientConnectionDelegate)state.getDelegate();
+
+ //We got the right server and created a new connection
+
failover(failedConnection, newConnection);
-// }
-// catch (Throwable t)
-// {
-// //TODO
-// //If failover itself fails, we shouldn't give up, we should try the next one in the list
-// //etc until we find one that works
-// //TODO
-// }
+ }
+ else
+ {
+ if (status.getActualFailoverNode() == -1)
+ {
+ //No trace of failover was detected on the server side - this might happen if the client side
+ //network fails temporarily so the client connection breaks but the server side network is still
+ //up and running - in this case we want to retry back on the original server
+
+ //TODO TODO TODO
+
+ log.info("No failover is occurring on server side");
+
+ }
+ else
+ {
+ //Server side failover has occurred / is occurring but we tried the wrong node
+ //Now we must try the correct node
+
+ //TODO TODO TODO
+
+ log.info("*** Got wrong server!");
+ }
+ }
}
private ClientConnectionFactoryDelegate getFailoverDelegate(ClientConnectionDelegate currentDelegate) throws JMSException
@@ -277,6 +304,8 @@
private void failover(ClientConnectionDelegate failedConnection, ClientConnectionDelegate newConnection) throws Exception
{
if (trace) { log.trace("calling handleFailover"); }
+
+ log.info("performing failover");
ConnectionState failedState = (ConnectionState)failedConnection.getState();
@@ -346,7 +375,7 @@
}
}
}
- log.info("Failedover done");
+ log.info("Failover done");
}
private void handleFailoverOnConsumer(ClientConnectionDelegate connectionDelegate,
Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java 2006-12-10 12:14:05 UTC (rev 1752)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java 2006-12-10 12:37:08 UTC (rev 1753)
@@ -36,6 +36,7 @@
import org.jboss.jms.delegate.ConnectionFactoryDelegate;
import org.jboss.jms.server.ServerPeer;
import org.jboss.jms.server.Version;
+import org.jboss.jms.server.endpoint.ConnectionStatus;
import org.jboss.jms.server.remoting.JMSWireFormat;
import org.jboss.jms.server.remoting.MessagingMarshallable;
import org.jboss.jms.server.remoting.MetaDataConstants;
@@ -128,6 +129,16 @@
{
throw new IllegalStateException("This invocation should not be handled here!");
}
+
+ /**
+ * This invocation should either be handled by the client-side interceptor chain or by the
+ * server-side endpoint.
+ */
+ public ConnectionStatus createFailoverConnectionDelegate(String username, String password, int failedNodeId)
+ throws JMSException
+ {
+ throw new IllegalStateException("This invocation should not be handled here!");
+ }
/**
* This invocation should either be handled by the client-side interceptor chain or by the
Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java 2006-12-10 12:14:05 UTC (rev 1752)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java 2006-12-10 12:37:08 UTC (rev 1753)
@@ -21,15 +21,18 @@
*/
package org.jboss.jms.server;
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+import java.io.Serializable;
import java.net.URL;
+import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+
import javax.management.Attribute;
import javax.management.MBeanServer;
import javax.management.ObjectName;
+
import org.jboss.aop.AspectXmlLoader;
import org.jboss.jms.server.connectionfactory.ConnectionFactoryJNDIMapper;
import org.jboss.jms.server.connectionmanager.SimpleConnectionManager;
@@ -47,7 +50,10 @@
import org.jboss.messaging.core.plugin.contract.MessageStore;
import org.jboss.messaging.core.plugin.contract.PersistenceManager;
import org.jboss.messaging.core.plugin.contract.PostOffice;
+import org.jboss.messaging.core.plugin.contract.ReplicationListener;
import org.jboss.messaging.core.plugin.contract.Replicator;
+import org.jboss.messaging.core.plugin.postoffice.cluster.DefaultClusteredPostOffice;
+import org.jboss.messaging.core.plugin.postoffice.cluster.FailoverStatus;
import org.jboss.messaging.core.tx.TransactionRepository;
import org.jboss.messaging.util.Util;
import org.jboss.mx.loading.UnifiedClassLoader3;
@@ -57,6 +63,8 @@
import org.jboss.system.ServiceMBeanSupport;
import org.w3c.dom.Element;
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
+
/**
* A JMS server peer.
*
@@ -95,6 +103,8 @@
private int objectIDSequence = 1;
+ private Object failoverStatusLock;
+
// wired components
private DestinationJNDIMapper destinationJNDIMapper;
@@ -150,6 +160,8 @@
consumers = new ConcurrentReaderHashMap();
version = Version.instance();
+
+ failoverStatusLock = new Object();
started = false;
}
@@ -610,10 +622,14 @@
//We also inject the replicator dependency into the ConnectionFactoryJNDIMapper
//This is a bit messy but we have a circular dependency
//POJOContainer should be able to help us here
+ //Yes, this is nasty
if (!queuePostOffice.isLocal())
{
- connFactoryJNDIMapper.injectReplicator((Replicator)queuePostOffice);
+ Replicator rep = (Replicator)queuePostOffice;
+ connFactoryJNDIMapper.injectReplicator(rep);
+ rep.registerListener(new FailoverListener());
+
}
}
return queuePostOffice;
@@ -656,7 +672,131 @@
{
return queuedExecutorPool;
}
-
+
+ /*
+ * Wait for failover from the specified node to complete
+ */
+ public int waitForFailover(int failedNodeId) throws Exception
+ {
+ //This node may be failing over for another node - in which case we must wait for that to be complete
+
+ log.info("Waiting for failover for failedNodeId: " + failedNodeId);
+
+ Replicator replicator = getReplicator();
+
+ //TODO - these must be configurable
+ final long FAILOVER_START_TIMEOUT = 15000;
+
+ final long FAILOVER_COMPLETE_TIMEOUT = 25000;
+
+ long startToWait = FAILOVER_START_TIMEOUT;
+
+ long completeToWait = FAILOVER_COMPLETE_TIMEOUT;
+
+ //Must lock here
+ synchronized (failoverStatusLock)
+ {
+ while (true)
+ {
+ //TODO we shouldn't have a dependency on DefaultClusteredPostOffice - where should we put the constants?
+ Map replicants = replicator.get(DefaultClusteredPostOffice.FAILED_OVER_FOR_KEY);
+
+ log.info("Got replicants");
+
+ boolean foundEntry = false;
+
+ if (replicants != null)
+ {
+ Iterator iter = replicants.entrySet().iterator();
+
+ while (iter.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)iter.next();
+
+ Integer nid = (Integer)entry.getKey();
+
+ FailoverStatus status = (FailoverStatus)entry.getValue();
+
+ if (status.isFailedOverForNode(failedNodeId))
+ {
+ log.info("Fail over is complete on node " + nid);
+ //Got the node - failover has completed
+ return nid.intValue();
+ }
+ else if (status.isFailingOverForNode(failedNodeId))
+ {
+ log.info("Fail over is in progress on node " + nid);
+
+ //A server has started failing over for the failed node, but not completed
+ //if it's not this node then we immediately return so the connection can be redirected to
+ //another node
+ if (nid.intValue() != this.getServerPeerID())
+ {
+ return nid.intValue();
+ }
+
+ //Otherwise we wait for failover to complete
+
+ if (completeToWait <= 0)
+ {
+ //Give up now
+ log.info("Already waited long enough for failover to complete, giving up");
+ return -1;
+ }
+
+ //Note - we have to count the time since other unrelated nodes may fail and wake
+ //up the lock - in this case we don't want to give up too early
+ long start = System.currentTimeMillis();
+ try
+ {
+ log.info("Waiting for failover to complete");
+ failoverStatusLock.wait(completeToWait);
+ }
+ catch (InterruptedException ignore)
+ {
+ }
+ completeToWait -= System.currentTimeMillis() - start;
+
+ foundEntry = true;
+ }
+ }
+ }
+
+ if (!foundEntry)
+ {
+ //No trace of failover happening
+ //so we wait a maximum of FAILOVER_START_TIMEOUT for some replicated data to arrive
+ //This should arrive fairly quickly since this is added at the beginning of the failover process
+ //If it doesn't arrive it would imply that no failover has actually happened on the server
+ //or the timeout is too short.
+ //It is possible that no failover has actually happened on the server, if for example there
+ //is a problem with the client side network but the server side network is ok.
+
+ if (startToWait <= 0)
+ {
+ //Don't want to wait again
+ log.info("Already waited long enough for failover to start, giving up");
+ return -1;
+ }
+
+ //Note - we have to count the time since other unrelated nodes may fail and wake
+ //up the lock - in this case we don't want to give up too early
+ long start = System.currentTimeMillis();
+ try
+ {
+ log.info("Waiting for failover to start");
+ failoverStatusLock.wait(startToWait);
+ log.info("Finished waiting for failover to start");
+ }
+ catch (InterruptedException ignore)
+ {
+ }
+ startToWait -= System.currentTimeMillis() - start;
+ }
+ }
+ }
+ }
+
public String toString()
{
return "ServerPeer [" + getServerPeerID() + "]";
@@ -907,5 +1047,23 @@
}
// Inner classes -------------------------------------------------
+
+ private class FailoverListener implements ReplicationListener
+ {
+ public void onReplicationChange(Serializable key, Map updatedReplicantMap, boolean added, int originatingNodeId)
+ {
+ if (key.equals(DefaultClusteredPostOffice.FAILED_OVER_FOR_KEY))
+ {
+ //We have a failover status change - notify anyone waiting
+
+ log.info("Got replication change on failed over map, notifying those waiting on lock");
+
+ synchronized (failoverStatusLock)
+ {
+ failoverStatusLock.notifyAll();
+ }
+ }
+ }
+ }
}
Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java 2006-12-10 12:14:05 UTC (rev 1752)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java 2006-12-10 12:37:08 UTC (rev 1753)
@@ -40,6 +40,9 @@
ConnectionDelegate createConnectionDelegate(String username, String password)
throws JMSException;
+ ConnectionStatus createFailoverConnectionDelegate(String username, String password, int failedNodeId)
+ throws JMSException;
+
byte[] getClientAOPConfig() throws JMSException;
IdBlock getIdBlock(int size) throws JMSException;
Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java 2006-12-10 12:14:05 UTC (rev 1752)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java 2006-12-10 12:37:08 UTC (rev 1753)
@@ -93,43 +93,81 @@
}
// ConnectionFactoryDelegate implementation ----------------------
-
- public ConnectionDelegate createConnectionDelegate(String username, String password)
- throws JMSException
+
+ /**
+ * Called when a new connection is to be created for failover
+ * The ConnectionStatus instance returns either contains the delegate or the node id of the actual node
+ * Note we cannot query the failover node in a separate call since that might change between
+ * querying it and actually creating the delegate
+ */
+ public ConnectionStatus createFailoverConnectionDelegate(String username, String password, int failedNodeId)
+ throws JMSException
{
try
{
- log.debug("creating a new connection for user " + username);
+ //Wait for server side failover to complete
+ int failoverNodeId = serverPeer.waitForFailover(failedNodeId);
+
+ if (failoverNodeId == -1 || failoverNodeId != serverPeer.getServerPeerID())
+ {
+ //We are on the wrong node - or no failover has occurred
+ return new ConnectionStatus(failoverNodeId);
+ }
+ else
+ {
+ //We are on the right node, and failover has completed
+ //we can now create a connection delegate
+ return new ConnectionStatus(createConnectionDelegateInternal(username, password));
+ }
+ }
+ catch (Throwable t)
+ {
+ throw ExceptionUtil.handleJMSInvocation(t, this + " createFailoverConnectionDelegate");
+ }
+
+ }
+
+ private ConnectionDelegate createConnectionDelegateInternal(String username, String password) throws Exception
+ {
+ log.debug("creating a new connection for user " + username);
- // authenticate the user
- serverPeer.getSecurityManager().authenticate(username, password);
+ // authenticate the user
+ serverPeer.getSecurityManager().authenticate(username, password);
- // see if there is a preconfigured client id for the user
- if (username != null)
+ // see if there is a preconfigured client id for the user
+ if (username != null)
+ {
+ String preconfClientID =
+ serverPeer.getJmsUserManagerInstance().getPreConfiguredClientID(username);
+
+ if (preconfClientID != null)
{
- String preconfClientID =
- serverPeer.getJmsUserManagerInstance().getPreConfiguredClientID(username);
-
- if (preconfClientID != null)
- {
- clientID = preconfClientID;
- }
+ clientID = preconfClientID;
}
+ }
- // create the corresponding "server-side" connection endpoint and register it with the
- // server peer's ClientManager
- ServerConnectionEndpoint endpoint =
- new ServerConnectionEndpoint(serverPeer, clientID, username, password, prefetchSize,
- defaultTempQueueFullSize, defaultTempQueuePageSize, defaultTempQueueDownCacheSize);
+ // create the corresponding "server-side" connection endpoint and register it with the
+ // server peer's ClientManager
+ ServerConnectionEndpoint endpoint =
+ new ServerConnectionEndpoint(serverPeer, clientID, username, password, prefetchSize,
+ defaultTempQueueFullSize, defaultTempQueuePageSize, defaultTempQueueDownCacheSize);
- int connectionID = endpoint.getConnectionID();
+ int connectionID = endpoint.getConnectionID();
- ConnectionAdvised connAdvised = new ConnectionAdvised(endpoint);
- JMSDispatcher.instance.registerTarget(new Integer(connectionID), connAdvised);
+ ConnectionAdvised connAdvised = new ConnectionAdvised(endpoint);
+ JMSDispatcher.instance.registerTarget(new Integer(connectionID), connAdvised);
- log.debug("created and registered " + endpoint);
+ log.debug("created and registered " + endpoint);
- return new ClientConnectionDelegate(connectionID, serverPeer.getServerPeerID());
+ return new ClientConnectionDelegate(connectionID, serverPeer.getServerPeerID());
+ }
+
+ public ConnectionDelegate createConnectionDelegate(String username, String password)
+ throws JMSException
+ {
+ try
+ {
+ return createConnectionDelegateInternal(username, password);
}
catch (Throwable t)
{
Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/advised/ConnectionFactoryAdvised.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/advised/ConnectionFactoryAdvised.java 2006-12-10 12:14:05 UTC (rev 1752)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/endpoint/advised/ConnectionFactoryAdvised.java 2006-12-10 12:37:08 UTC (rev 1753)
@@ -24,6 +24,7 @@
import javax.jms.JMSException;
import org.jboss.jms.delegate.ConnectionDelegate;
import org.jboss.jms.server.endpoint.ConnectionFactoryEndpoint;
+import org.jboss.jms.server.endpoint.ConnectionStatus;
import org.jboss.messaging.core.plugin.IdBlock;
/**
@@ -62,6 +63,12 @@
{
return endpoint.createConnectionDelegate(username, password);
}
+
+ public ConnectionStatus createFailoverConnectionDelegate(String username, String password, int failedNodeId)
+ throws JMSException
+ {
+ return endpoint.createFailoverConnectionDelegate(username, password, failedNodeId);
+ }
public byte[] getClientAOPConfig() throws JMSException
{
Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java 2006-12-10 12:14:05 UTC (rev 1752)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java 2006-12-10 12:37:08 UTC (rev 1753)
@@ -82,6 +82,7 @@
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
* @version <tt>$Revision: 1.1 $</tt>
*
* $Id$
@@ -95,6 +96,9 @@
// Key for looking up node id -> address info mapping from replicated data
public static final String ADDRESS_INFO_KEY = "address_info";
+ // Key for looking up node id -> failed over for node id mapping from replicated data
+ public static final String FAILED_OVER_FOR_KEY = "failed_over_for";
+
//Used for failure testing
private boolean failBeforeCommit;
@@ -125,7 +129,7 @@
private Map holdingArea;
- //Map < node, failover node>
+ //Map < node id , failover node id>
private Map failoverMap;
private Set leftSet;
@@ -1359,31 +1363,56 @@
}
/**
- * This method fails over all the queues from node <nodeId> onto this node
+ * This method fails over all the queues from node <failedNodeId> onto this node
* It is triggered when a JGroups view change occurs due to a member leaving and
* it's determined the member didn't leave cleanly
*
- * @param nodeId
+ * @param failedNodeId
* @throws Exception
*/
- private void failOver(int nodeId) throws Exception
+ private void failOver(int failedNodeId) throws Exception
{
- // todo - remove this log.info before merging into trunk
- log.info("Preparing failover against node " + nodeId);
-
//Need to lock
- lock.writeLock().acquire();
+ lock.writeLock().acquire();
try
{
- log.info("Preparing failover against node " + nodeId);
+ log.info("Preparing failover against node " + failedNodeId);
+ /*
+ We make sure a FailoverStatus object is put in the replicated data for the node
+ The real failover node will always add this in.
+ This means that each node knows which node has really started the failover for another node, and
+ which node did failover for other nodes in the past
+ We cannot rely on the failoverMap for this, since that will regenerated once failover is done,
+ because of the change in membership.
+ And clients may failover after that and need to know if they have the correct node.
+ Since this is the first thing we do after detecting failover, it should be very quick that
+ all nodes know, however there is still a chance that a client tries to failover before
+ the information is replicated.
+ */
+
+ Map replicants = (Map)get(FAILED_OVER_FOR_KEY);
+
+ FailoverStatus status = (FailoverStatus)replicants.get(new Integer(currentNodeId));
+
+ if (status == null)
+ {
+ status = new FailoverStatus();
+ }
+
+ status.startFailingOverForNode(failedNodeId);
+
+ put(FAILED_OVER_FOR_KEY, status);
+
+ log.info("Put into failed over map that starting failover");
+
//Get the map of queues for the failed node
- Map subMaps = (Map)nameMaps.get(new Integer(nodeId));
+ Map subMaps = (Map)nameMaps.get(new Integer(failedNodeId));
if (subMaps==null || subMaps.size()==0)
{
- log.warn("Couldn't find any binding to failOver from serverId=" +nodeId);
+ log.warn("Couldn't find any binding to failOver from serverId=" +failedNodeId);
return;
}
@@ -1435,16 +1464,16 @@
String queueName = (String)entry.getKey();
//First the binding is removed from the in memory condition and name maps
- this.removeBinding(nodeId, queueName);
+ this.removeBinding(failedNodeId, queueName);
//Then deleted from the database
- this.deleteBinding(nodeId, queueName);
+ this.deleteBinding(failedNodeId, queueName);
log.info("deleted binding for " + queueName);
//Then an unbind request is sent - this cause other nodes to also remove it from the in memory
//condition and name maps
- UnbindRequest unbindRequest = new UnbindRequest(nodeId, queueName);
+ UnbindRequest unbindRequest = new UnbindRequest(failedNodeId, queueName);
syncSendRequest(unbindRequest);
@@ -1498,6 +1527,13 @@
//lost from the database when the server is resurrected.
//To remedy, both db operations need to be done in the same JBDC tx
}
+
+ log.info("Server side fail over is now complete");
+
+ //TODO - should this be in a finally? I'm not sure
+ status.finishFailingOver();
+
+ put(FAILED_OVER_FOR_KEY, status);
}
finally
{
Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java 2006-12-10 12:14:05 UTC (rev 1752)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java 2006-12-10 12:37:08 UTC (rev 1753)
@@ -74,349 +74,349 @@
* Test that connections created using a clustered connection factory are created round robin on
* different servers
*/
- public void testRoundRobinConnectionCreation() throws Exception
- {
- JBossConnectionFactory factory = (JBossConnectionFactory )ic0.lookup("/ConnectionFactory");
-
- ClusteredClientConnectionFactoryDelegate delegate =
- (ClusteredClientConnectionFactoryDelegate)factory.getDelegate();
-
- log.info ("number of delegates = " + delegate.getDelegates().length);
- log.info ("number of servers = " + ServerManagement.getServer(0).getNumberOfNodesOnCluster());
-
- assertEquals(3, delegate.getDelegates().length);
-
- ClientConnectionFactoryDelegate cf1 = delegate.getDelegates()[0];
-
- ClientConnectionFactoryDelegate cf2 = delegate.getDelegates()[1];
-
- ClientConnectionFactoryDelegate cf3 = delegate.getDelegates()[2];
-
- assertEquals(0, cf1.getServerId());
-
- assertEquals(1, cf2.getServerId());
-
- assertEquals(2, cf3.getServerId());
-
- assertEquals(3, ServerManagement.getServer(0).getNumberOfNodesOnCluster());
-
- Connection conn1 = null;
-
- Connection conn2 = null;
-
- Connection conn3 = null;
-
- Connection conn4 = null;
-
- Connection conn5 = null;
-
- try
- {
- conn1 = factory.createConnection();
-
- conn2 = factory.createConnection();
-
- conn3 = factory.createConnection();
-
- conn4 = factory.createConnection();
-
- conn5 = factory.createConnection();
-
- ConnectionState state1 = (ConnectionState)(((DelegateSupport)((JBossConnection)conn1).getDelegate()).getState());
-
- ConnectionState state2 = (ConnectionState)(((DelegateSupport)((JBossConnection)conn2).getDelegate()).getState());
-
- ConnectionState state3 = (ConnectionState)(((DelegateSupport)((JBossConnection)conn3).getDelegate()).getState());
-
- ConnectionState state4 = (ConnectionState)(((DelegateSupport)((JBossConnection)conn4).getDelegate()).getState());
-
- ConnectionState state5 = (ConnectionState)(((DelegateSupport)((JBossConnection)conn5).getDelegate()).getState());
-
- int serverID1 = state1.getServerID();
-
- int serverID2 = state2.getServerID();
-
- int serverID3 = state3.getServerID();
-
- int serverID4 = state4.getServerID();
-
- int serverID5 = state5.getServerID();
-
- log.info("server id 1: " + serverID1);
-
- log.info("server id 2: " + serverID2);
-
- log.info("server id 3: " + serverID3);
-
- log.info("server id 4: " + serverID4);
-
- log.info("server id 5: " + serverID5);
-
- assertEquals(0, serverID1);
-
- assertEquals(1, serverID2);
-
- assertEquals(2, serverID3);
-
- assertEquals(0, serverID4);
-
- assertEquals(1, serverID5);
- }
- finally
- {
- if (conn1 != null)
- {
- conn1.close();
- }
-
- if (conn2 != null)
- {
- conn2.close();
- }
-
- if (conn3 != null)
- {
- conn3.close();
- }
-
- if (conn4 != null)
- {
- conn4.close();
- }
-
- if (conn5 != null)
- {
- conn5.close();
- }
- }
-
- }
-
- /*
- * Test that the failover mapping is created correctly and updated properly when nodes leave
- * or join
- */
- public void testDefaultFailoverMap() throws Exception
- {
- {
- JBossConnectionFactory factory = (JBossConnectionFactory )ic0.lookup("/ConnectionFactory");
-
- ClusteredClientConnectionFactoryDelegate delegate =
- (ClusteredClientConnectionFactoryDelegate)factory.getDelegate();
-
- assertEquals(3, ServerManagement.getServer(0).getNumberOfNodesOnCluster());
-
- ClientConnectionFactoryDelegate[] delegates = delegate.getDelegates();
-
- ClientConnectionFactoryDelegate cf1 = delegate.getDelegates()[0];
-
- ClientConnectionFactoryDelegate cf2 = delegate.getDelegates()[1];
-
- ClientConnectionFactoryDelegate cf3 = delegate.getDelegates()[2];
-
- //The order here depends on the order the servers were started in
-
- //If any servers get stopped and then started then the order will change
-
- log.info("cf1 serverid=" + cf1.getServerId());
-
- log.info("cf2 serverid=" + cf2.getServerId());
-
- log.info("cf3 serverid=" + cf3.getServerId());
-
-
- assertEquals(0, cf1.getServerId());
-
- assertEquals(1, cf2.getServerId());
-
- assertEquals(2, cf3.getServerId());
-
- Map failoverMap = delegate.getFailoverMap();
-
- assertEquals(3, delegates.length);
-
- assertEquals(3, failoverMap.size());
-
- // Default failover policy just chooses the node to the right
-
- assertEquals(cf2.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
-
- assertEquals(cf3.getServerId(), ((Integer)failoverMap.get(new Integer(cf2.getServerId()))).intValue());
-
- assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf3.getServerId()))).intValue());
- }
-
- //Now cleanly stop one of the servers
-
-
- log.info("************** STOPPING SERVER 0");
- ServerManagement.stop(0, true);
-
- log.info("server stopped");
-
- assertEquals(2, ServerManagement.getServer(1).getNumberOfNodesOnCluster());
-
- {
- //Lookup another connection factory
-
- JBossConnectionFactory factory = (JBossConnectionFactory )ic1.lookup("/ConnectionFactory");
-
- log.info("Got connection factory");
-
- ClusteredClientConnectionFactoryDelegate delegate =
- (ClusteredClientConnectionFactoryDelegate)factory.getDelegate();
-
- ClientConnectionFactoryDelegate[] delegates = delegate.getDelegates();
-
- Map failoverMap = delegate.getFailoverMap();
-
- log.info("Got failover map");
-
- assertEquals(2, delegates.length);
-
- ClientConnectionFactoryDelegate cf1 = delegate.getDelegates()[0];
-
- ClientConnectionFactoryDelegate cf2 = delegate.getDelegates()[1];
-
- //Order here depends on order servers were started in
-
- log.info("cf1 serverid=" + cf1.getServerId());
-
- log.info("cf2 serverid=" + cf2.getServerId());
-
- assertEquals(1, cf1.getServerId());
-
- assertEquals(2, cf2.getServerId());
-
-
- assertEquals(2, failoverMap.size());
-
- assertEquals(cf2.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
-
- assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf2.getServerId()))).intValue());
- }
-
- //Cleanly stop another server
-
- log.info("Server 1 is started: " + ServerManagement.getServer(1).isServerPeerStarted());
-
- ServerManagement.stop(1, true);
-
- assertEquals(1, ServerManagement.getServer(2).getNumberOfNodesOnCluster());
-
- {
- //Lookup another connection factory
-
- JBossConnectionFactory factory = (JBossConnectionFactory )ic2.lookup("/ConnectionFactory");
-
- ClusteredClientConnectionFactoryDelegate delegate =
- (ClusteredClientConnectionFactoryDelegate)factory.getDelegate();
-
- ClientConnectionFactoryDelegate[] delegates = delegate.getDelegates();
-
- Map failoverMap = delegate.getFailoverMap();
-
- assertEquals(1, delegates.length);
-
- ClientConnectionFactoryDelegate cf1 = delegate.getDelegates()[0];
-
- assertEquals(2, cf1.getServerId());
-
-
- assertEquals(1, failoverMap.size());
-
- assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
- }
-
- //Restart server 0
-
- ServerManagement.start("all", 0);
-
- {
- JBossConnectionFactory factory = (JBossConnectionFactory )ic0.lookup("/ConnectionFactory");
-
- log.info("Got connection factory");
-
- ClusteredClientConnectionFactoryDelegate delegate =
- (ClusteredClientConnectionFactoryDelegate)factory.getDelegate();
-
- ClientConnectionFactoryDelegate[] delegates = delegate.getDelegates();
-
- Map failoverMap = delegate.getFailoverMap();
-
- log.info("Got failover map");
-
- assertEquals(2, delegates.length);
-
- ClientConnectionFactoryDelegate cf1 = delegate.getDelegates()[0];
-
- ClientConnectionFactoryDelegate cf2 = delegate.getDelegates()[1];
-
- log.info("cf1 serverid=" + cf1.getServerId());
-
- log.info("cf2 serverid=" + cf2.getServerId());
-
- assertEquals(2, cf1.getServerId());
-
- assertEquals(0, cf2.getServerId());
-
-
- assertEquals(2, failoverMap.size());
-
- assertEquals(cf2.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
-
- assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf2.getServerId()))).intValue());
- }
-
-
- //Restart server 1
-
- ServerManagement.start("all", 1);
-
- {
- JBossConnectionFactory factory = (JBossConnectionFactory )ic1.lookup("/ConnectionFactory");
-
- log.info("Got connection factory");
-
- ClusteredClientConnectionFactoryDelegate delegate =
- (ClusteredClientConnectionFactoryDelegate)factory.getDelegate();
-
- ClientConnectionFactoryDelegate[] delegates = delegate.getDelegates();
-
- Map failoverMap = delegate.getFailoverMap();
-
- log.info("Got failover map");
-
- assertEquals(3, delegates.length);
-
- ClientConnectionFactoryDelegate cf1 = delegate.getDelegates()[0];
-
- ClientConnectionFactoryDelegate cf2 = delegate.getDelegates()[1];
-
- ClientConnectionFactoryDelegate cf3 = delegate.getDelegates()[2];
-
- log.info("cf1 serverid=" + cf1.getServerId());
-
- log.info("cf2 serverid=" + cf2.getServerId());
-
- log.info("cf3 serverid=" + cf3.getServerId());
-
- assertEquals(2, cf1.getServerId());
-
- assertEquals(0, cf2.getServerId());
-
- assertEquals(1, cf3.getServerId());
-
-
- assertEquals(3, failoverMap.size());
-
- assertEquals(cf2.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
-
- assertEquals(cf3.getServerId(), ((Integer)failoverMap.get(new Integer(cf2.getServerId()))).intValue());
-
- assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf3.getServerId()))).intValue());
- }
- }
+// public void testRoundRobinConnectionCreation() throws Exception
+// {
+// JBossConnectionFactory factory = (JBossConnectionFactory )ic0.lookup("/ConnectionFactory");
+//
+// ClusteredClientConnectionFactoryDelegate delegate =
+// (ClusteredClientConnectionFactoryDelegate)factory.getDelegate();
+//
+// log.info ("number of delegates = " + delegate.getDelegates().length);
+// log.info ("number of servers = " + ServerManagement.getServer(0).getNumberOfNodesOnCluster());
+//
+// assertEquals(3, delegate.getDelegates().length);
+//
+// ClientConnectionFactoryDelegate cf1 = delegate.getDelegates()[0];
+//
+// ClientConnectionFactoryDelegate cf2 = delegate.getDelegates()[1];
+//
+// ClientConnectionFactoryDelegate cf3 = delegate.getDelegates()[2];
+//
+// assertEquals(0, cf1.getServerId());
+//
+// assertEquals(1, cf2.getServerId());
+//
+// assertEquals(2, cf3.getServerId());
+//
+// assertEquals(3, ServerManagement.getServer(0).getNumberOfNodesOnCluster());
+//
+// Connection conn1 = null;
+//
+// Connection conn2 = null;
+//
+// Connection conn3 = null;
+//
+// Connection conn4 = null;
+//
+// Connection conn5 = null;
+//
+// try
+// {
+// conn1 = factory.createConnection();
+//
+// conn2 = factory.createConnection();
+//
+// conn3 = factory.createConnection();
+//
+// conn4 = factory.createConnection();
+//
+// conn5 = factory.createConnection();
+//
+// ConnectionState state1 = (ConnectionState)(((DelegateSupport)((JBossConnection)conn1).getDelegate()).getState());
+//
+// ConnectionState state2 = (ConnectionState)(((DelegateSupport)((JBossConnection)conn2).getDelegate()).getState());
+//
+// ConnectionState state3 = (ConnectionState)(((DelegateSupport)((JBossConnection)conn3).getDelegate()).getState());
+//
+// ConnectionState state4 = (ConnectionState)(((DelegateSupport)((JBossConnection)conn4).getDelegate()).getState());
+//
+// ConnectionState state5 = (ConnectionState)(((DelegateSupport)((JBossConnection)conn5).getDelegate()).getState());
+//
+// int serverID1 = state1.getServerID();
+//
+// int serverID2 = state2.getServerID();
+//
+// int serverID3 = state3.getServerID();
+//
+// int serverID4 = state4.getServerID();
+//
+// int serverID5 = state5.getServerID();
+//
+// log.info("server id 1: " + serverID1);
+//
+// log.info("server id 2: " + serverID2);
+//
+// log.info("server id 3: " + serverID3);
+//
+// log.info("server id 4: " + serverID4);
+//
+// log.info("server id 5: " + serverID5);
+//
+// assertEquals(0, serverID1);
+//
+// assertEquals(1, serverID2);
+//
+// assertEquals(2, serverID3);
+//
+// assertEquals(0, serverID4);
+//
+// assertEquals(1, serverID5);
+// }
+// finally
+// {
+// if (conn1 != null)
+// {
+// conn1.close();
+// }
+//
+// if (conn2 != null)
+// {
+// conn2.close();
+// }
+//
+// if (conn3 != null)
+// {
+// conn3.close();
+// }
+//
+// if (conn4 != null)
+// {
+// conn4.close();
+// }
+//
+// if (conn5 != null)
+// {
+// conn5.close();
+// }
+// }
+//
+// }
+//
+// /*
+// * Test that the failover mapping is created correctly and updated properly when nodes leave
+// * or join
+// */
+// public void testDefaultFailoverMap() throws Exception
+// {
+// {
+// JBossConnectionFactory factory = (JBossConnectionFactory )ic0.lookup("/ConnectionFactory");
+//
+// ClusteredClientConnectionFactoryDelegate delegate =
+// (ClusteredClientConnectionFactoryDelegate)factory.getDelegate();
+//
+// assertEquals(3, ServerManagement.getServer(0).getNumberOfNodesOnCluster());
+//
+// ClientConnectionFactoryDelegate[] delegates = delegate.getDelegates();
+//
+// ClientConnectionFactoryDelegate cf1 = delegate.getDelegates()[0];
+//
+// ClientConnectionFactoryDelegate cf2 = delegate.getDelegates()[1];
+//
+// ClientConnectionFactoryDelegate cf3 = delegate.getDelegates()[2];
+//
+// //The order here depends on the order the servers were started in
+//
+// //If any servers get stopped and then started then the order will change
+//
+// log.info("cf1 serverid=" + cf1.getServerId());
+//
+// log.info("cf2 serverid=" + cf2.getServerId());
+//
+// log.info("cf3 serverid=" + cf3.getServerId());
+//
+//
+// assertEquals(0, cf1.getServerId());
+//
+// assertEquals(1, cf2.getServerId());
+//
+// assertEquals(2, cf3.getServerId());
+//
+// Map failoverMap = delegate.getFailoverMap();
+//
+// assertEquals(3, delegates.length);
+//
+// assertEquals(3, failoverMap.size());
+//
+// // Default failover policy just chooses the node to the right
+//
+// assertEquals(cf2.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
+//
+// assertEquals(cf3.getServerId(), ((Integer)failoverMap.get(new Integer(cf2.getServerId()))).intValue());
+//
+// assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf3.getServerId()))).intValue());
+// }
+//
+// //Now cleanly stop one of the servers
+//
+//
+// log.info("************** STOPPING SERVER 0");
+// ServerManagement.stop(0, true);
+//
+// log.info("server stopped");
+//
+// assertEquals(2, ServerManagement.getServer(1).getNumberOfNodesOnCluster());
+//
+// {
+// //Lookup another connection factory
+//
+// JBossConnectionFactory factory = (JBossConnectionFactory )ic1.lookup("/ConnectionFactory");
+//
+// log.info("Got connection factory");
+//
+// ClusteredClientConnectionFactoryDelegate delegate =
+// (ClusteredClientConnectionFactoryDelegate)factory.getDelegate();
+//
+// ClientConnectionFactoryDelegate[] delegates = delegate.getDelegates();
+//
+// Map failoverMap = delegate.getFailoverMap();
+//
+// log.info("Got failover map");
+//
+// assertEquals(2, delegates.length);
+//
+// ClientConnectionFactoryDelegate cf1 = delegate.getDelegates()[0];
+//
+// ClientConnectionFactoryDelegate cf2 = delegate.getDelegates()[1];
+//
+// //Order here depends on order servers were started in
+//
+// log.info("cf1 serverid=" + cf1.getServerId());
+//
+// log.info("cf2 serverid=" + cf2.getServerId());
+//
+// assertEquals(1, cf1.getServerId());
+//
+// assertEquals(2, cf2.getServerId());
+//
+//
+// assertEquals(2, failoverMap.size());
+//
+// assertEquals(cf2.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
+//
+// assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf2.getServerId()))).intValue());
+// }
+//
+// //Cleanly stop another server
+//
+// log.info("Server 1 is started: " + ServerManagement.getServer(1).isServerPeerStarted());
+//
+// ServerManagement.stop(1, true);
+//
+// assertEquals(1, ServerManagement.getServer(2).getNumberOfNodesOnCluster());
+//
+// {
+// //Lookup another connection factory
+//
+// JBossConnectionFactory factory = (JBossConnectionFactory )ic2.lookup("/ConnectionFactory");
+//
+// ClusteredClientConnectionFactoryDelegate delegate =
+// (ClusteredClientConnectionFactoryDelegate)factory.getDelegate();
+//
+// ClientConnectionFactoryDelegate[] delegates = delegate.getDelegates();
+//
+// Map failoverMap = delegate.getFailoverMap();
+//
+// assertEquals(1, delegates.length);
+//
+// ClientConnectionFactoryDelegate cf1 = delegate.getDelegates()[0];
+//
+// assertEquals(2, cf1.getServerId());
+//
+//
+// assertEquals(1, failoverMap.size());
+//
+// assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
+// }
+//
+// //Restart server 0
+//
+// ServerManagement.start("all", 0);
+//
+// {
+// JBossConnectionFactory factory = (JBossConnectionFactory )ic0.lookup("/ConnectionFactory");
+//
+// log.info("Got connection factory");
+//
+// ClusteredClientConnectionFactoryDelegate delegate =
+// (ClusteredClientConnectionFactoryDelegate)factory.getDelegate();
+//
+// ClientConnectionFactoryDelegate[] delegates = delegate.getDelegates();
+//
+// Map failoverMap = delegate.getFailoverMap();
+//
+// log.info("Got failover map");
+//
+// assertEquals(2, delegates.length);
+//
+// ClientConnectionFactoryDelegate cf1 = delegate.getDelegates()[0];
+//
+// ClientConnectionFactoryDelegate cf2 = delegate.getDelegates()[1];
+//
+// log.info("cf1 serverid=" + cf1.getServerId());
+//
+// log.info("cf2 serverid=" + cf2.getServerId());
+//
+// assertEquals(2, cf1.getServerId());
+//
+// assertEquals(0, cf2.getServerId());
+//
+//
+// assertEquals(2, failoverMap.size());
+//
+// assertEquals(cf2.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
+//
+// assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf2.getServerId()))).intValue());
+// }
+//
+//
+// //Restart server 1
+//
+// ServerManagement.start("all", 1);
+//
+// {
+// JBossConnectionFactory factory = (JBossConnectionFactory )ic1.lookup("/ConnectionFactory");
+//
+// log.info("Got connection factory");
+//
+// ClusteredClientConnectionFactoryDelegate delegate =
+// (ClusteredClientConnectionFactoryDelegate)factory.getDelegate();
+//
+// ClientConnectionFactoryDelegate[] delegates = delegate.getDelegates();
+//
+// Map failoverMap = delegate.getFailoverMap();
+//
+// log.info("Got failover map");
+//
+// assertEquals(3, delegates.length);
+//
+// ClientConnectionFactoryDelegate cf1 = delegate.getDelegates()[0];
+//
+// ClientConnectionFactoryDelegate cf2 = delegate.getDelegates()[1];
+//
+// ClientConnectionFactoryDelegate cf3 = delegate.getDelegates()[2];
+//
+// log.info("cf1 serverid=" + cf1.getServerId());
+//
+// log.info("cf2 serverid=" + cf2.getServerId());
+//
+// log.info("cf3 serverid=" + cf3.getServerId());
+//
+// assertEquals(2, cf1.getServerId());
+//
+// assertEquals(0, cf2.getServerId());
+//
+// assertEquals(1, cf3.getServerId());
+//
+//
+// assertEquals(3, failoverMap.size());
+//
+// assertEquals(cf2.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
+//
+// assertEquals(cf3.getServerId(), ((Integer)failoverMap.get(new Integer(cf2.getServerId()))).intValue());
+//
+// assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf3.getServerId()))).intValue());
+// }
+// }
public void testSimpleFailover() throws Exception
{
@@ -537,45 +537,45 @@
}
}
+//
+// public void testEvenSimplerFailover() throws Exception
+// {
+// JBossConnectionFactory factory = (JBossConnectionFactory )ic0.lookup("/ConnectionFactory");
+//
+// Connection conn = null;
+//
+// try
+// {
+// conn = factory.createConnection();
+//
+// log.info("************ KILLING (CRASHING) SERVER 0");
+//
+// ServerManagement.getServer(0).destroy();
+//
+// log.info("killed server, now waiting");
+//
+// Thread.sleep(25000);
+//
+// log.info("done wait");
+// }
+// finally
+// {
+// if (conn != null)
+// {
+// try
+// {
+// conn.close();
+// }
+// catch (Exception e)
+// {
+// e.printStackTrace();
+// }
+// }
+// }
+//
+// }
- public void testEvenSimplerFailover() throws Exception
- {
- JBossConnectionFactory factory = (JBossConnectionFactory )ic0.lookup("/ConnectionFactory");
-
- Connection conn = null;
-
- try
- {
- conn = factory.createConnection();
-
- log.info("************ KILLING (CRASHING) SERVER 0");
-
- ServerManagement.getServer(0).destroy();
-
- log.info("killed server, now waiting");
-
- Thread.sleep(25000);
-
- log.info("done wait");
- }
- finally
- {
- if (conn != null)
- {
- try
- {
- conn.close();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
-
- }
-
// public void testConnectionFactoryConnect() throws Exception
// {
// try
More information about the jboss-cvs-commits
mailing list