[jboss-cvs] JBoss Messaging SVN: r1787 - in trunk: src/main/org/jboss/jms/client/container src/main/org/jboss/jms/client/delegate src/main/org/jboss/jms/client/state src/main/org/jboss/jms/server src/main/org/jboss/jms/server/connectionfactory src/main/org/jboss/jms/server/endpoint src/main/org/jboss/messaging/core src/main/org/jboss/messaging/core/plugin/postoffice/cluster tests/etc tests/src/org/jboss/test/messaging/jms/clustering

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Dec 14 01:09:59 EST 2006


Author: ovidiu.feodorov at jboss.com
Date: 2006-12-14 01:09:44 -0500 (Thu, 14 Dec 2006)
New Revision: 1787

Modified:
   trunk/src/main/org/jboss/jms/client/container/HAAspect.java
   trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java
   trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
   trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
   trunk/src/main/org/jboss/jms/client/delegate/ClusteredClientConnectionFactoryDelegate.java
   trunk/src/main/org/jboss/jms/client/state/ConnectionState.java
   trunk/src/main/org/jboss/jms/server/ServerPeer.java
   trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
   trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
   trunk/src/main/org/jboss/messaging/core/ChannelSupport.java
   trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java
   trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java
   trunk/tests/etc/log4j.xml
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java
Log:
Refactoring, better logging.


Modified: trunk/src/main/org/jboss/jms/client/container/HAAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/HAAspect.java	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/src/main/org/jboss/jms/client/container/HAAspect.java	2006-12-14 06:09:44 UTC (rev 1787)
@@ -117,10 +117,12 @@
       if (delegates == null)
       {
          // not clustered, pass the invocation through
+         if(trace) { log.trace(this + " detecting non-clustered connection creation request, letting it pass through"); }
+
          return invocation.invokeNext();
       }
 
-      // clustered
+      // clustered, stopping the invocation here and re-send it as non-clustered down the stack
 
       // TODO: this should be in loop while we get exceptions creating connections, always trying
       //       the next Delegate when we get an exception.
@@ -130,15 +132,29 @@
 
       ClientConnectionFactoryDelegate cfDelegate = getDelegateRoundRobin();
 
+      if(trace) { log.trace(this + " detecting clustered connection creation request, choosing " + cfDelegate + " as target"); }
+
       // Now create a connection delegate for this
 
       MethodInvocation mi = (MethodInvocation)invocation;
       String username = (String)mi.getArguments()[0];
       String password = (String)mi.getArguments()[1];
 
-      ClientConnectionDelegate cd = createConnection(cfDelegate, username, password);
+      CreateConnectionResult res = (CreateConnectionResult)cfDelegate.
+         createConnectionDelegate(username, password, -1);
 
-      return new CreateConnectionResult(cd);
+      ClientConnectionDelegate cd = (ClientConnectionDelegate)res.getDelegate();
+
+      if(trace) { log.trace(this + " got local connection delegate " + cd); }
+
+      // Add a connection listener to detect failure
+
+      ConnectionListener listener = new ConnectionFailureListener(cd);
+      ConnectionState state = (ConnectionState)((DelegateSupport)cd).getState();
+      if(trace) { log.trace(this + " registering " + listener + " on " + cd); }
+      state.getRemotingConnection().getInvokingClient().addConnectionListener(listener);
+
+      return new CreateConnectionResult(cd); 
    }
 
    public String toString()
@@ -204,25 +220,6 @@
       return currentDelegate;
    }
 
-   private ClientConnectionDelegate createConnection(ClientConnectionFactoryDelegate cfd,
-                                                     String username,
-                                                     String password)
-      throws Exception
-   {
-      CreateConnectionResult res =
-         (CreateConnectionResult)cfd.createConnectionDelegate(username, password, -1);
-
-      ClientConnectionDelegate cd = (ClientConnectionDelegate)res.getDelegate();
-
-      // Add a connection listener to detect failure
-
-      ConnectionListener listener = new ConnectionFailureListener(cd);
-      ConnectionState state = (ConnectionState)((DelegateSupport)cd).getState();
-      state.getRemotingConnection().getInvokingClient().addConnectionListener(listener);
-
-      return cd;
-   }
-
    /**
     * @return a failover ClientConnectionFactoryDelegate or null if a suitable delegate cannot be
     *         found.
@@ -235,7 +232,7 @@
 
       for (int i = 0; i < delegates.length; i++)
       {
-         if (delegates[i].getServerId() == failoverServerID.intValue())
+         if (delegates[i].getServerID() == failoverServerID.intValue())
          {
             return delegates[i];
          }
@@ -251,7 +248,7 @@
 
       int failedServerID = failedConnState.getServerID();
 
-      log.debug(this + " handling failure on connection to node " + failedServerID);
+      log.debug(this + " handling failed connection to node " + failedServerID);
 
       // Get the default connection factory delegate we are going to failover onto
 
@@ -308,7 +305,7 @@
 
          for (int i = 0; i < delegates.length; i++)
          {
-            if (delegates[i].getServerId() == actualServerID)
+            if (delegates[i].getServerID() == actualServerID)
             {
                failoverDelegate = delegates[i];
                continue outer;

Modified: trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java	2006-12-14 06:09:44 UTC (rev 1787)
@@ -45,6 +45,7 @@
 import org.jboss.jms.message.MessageIdGeneratorFactory;
 import org.jboss.jms.server.Version;
 import org.jboss.jms.server.endpoint.CreateConnectionResult;
+import org.jboss.logging.Logger;
 
 /**
  * Maintains the hierarchy of parent and child state objects. For each delegate, this interceptor
@@ -55,22 +56,26 @@
  * 
  * This interceptor is PER_VM.
  * 
- * @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.org>Clebert Suconic</a>
+ * @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.org">Clebert Suconic</a>
  *
  * $Id$
  */
 public class StateCreationAspect
 {
    // Constants -----------------------------------------------------
-   
+
+   private static final Logger log = Logger.getLogger(StateCreationAspect.class);
+
    // Attributes ----------------------------------------------------
-   
+
+   private boolean trace = log.isTraceEnabled();
+
    // Static --------------------------------------------------------
 
    // Constructors --------------------------------------------------
-   
+
    // Public --------------------------------------------------------
 
    // Interceptor implementation -----------------------------------
@@ -78,72 +83,68 @@
    public Object handleCreateConnectionDelegate(Invocation inv) throws Throwable
    {
       ConnectionFactoryDelegate cfd = (ConnectionFactoryDelegate)inv.getTargetObject();
-      
+
       CreateConnectionResult res = (CreateConnectionResult)inv.invokeNext();
-      
+
+      if(trace) { log.trace("got " + res + " on return"); }
+
       ClientConnectionDelegate connectionDelegate = (ClientConnectionDelegate)res.getDelegate();
-      
+
       if (connectionDelegate != null)
-      {         
+      {
          connectionDelegate.init();
-         
-         //SimpleMetaData md = ((Advised)connectionDelegate)._getInstanceAdvisor().getMetaData();
-         
-         int serverID = connectionDelegate.getServerId();
-         
+
+         int serverID = connectionDelegate.getServerID();
          Version versionToUse = connectionDelegate.getVersionToUse();
-         
-         JMSRemotingConnection connection = connectionDelegate.getRemotingConnection();
-         
+         JMSRemotingConnection remotingConn = connectionDelegate.getRemotingConnection();
+
          if (versionToUse == null)
          {
             throw new IllegalStateException("Connection version is null");
          }
-         
-         //We have one message id generator per unique server
-         MessageIdGenerator gen =
-            MessageIdGeneratorFactory.instance.checkOutGenerator(serverID, cfd);
-         
+
+         // We have one message id generator per unique server
+         MessageIdGenerator g = MessageIdGeneratorFactory.instance.checkOutGenerator(serverID, cfd);
+
          ConnectionState connectionState =
-            new ConnectionState(serverID, connectionDelegate,
-                                connection, versionToUse, gen);
-         
+            new ConnectionState(serverID, connectionDelegate, remotingConn, versionToUse, g);
+
          connectionDelegate.setState(connectionState);
       }
-      
+
       return res;
    }
-   
+
    public Object handleCreateSessionDelegate(Invocation invocation) throws Throwable
    {
       SessionDelegate sessionDelegate = (SessionDelegate)invocation.invokeNext();
       DelegateSupport delegate = (DelegateSupport)sessionDelegate;
-      
+
       delegate.init();
-      
+
       ConnectionState connectionState = (ConnectionState)getState(invocation);
-      
+
       MethodInvocation mi = (MethodInvocation)invocation;
       boolean transacted = ((Boolean)mi.getArguments()[0]).booleanValue();
       int ackMode = ((Integer)mi.getArguments()[1]).intValue();
       boolean xa = ((Boolean)mi.getArguments()[2]).booleanValue();
-      
+
       SessionState sessionState =
          new SessionState(connectionState, sessionDelegate, transacted, ackMode, xa);
-      
+
       delegate.setState(sessionState);
       return delegate;
    }
-   
+
    public Object handleCreateConsumerDelegate(Invocation invocation) throws Throwable
    {
       ClientConsumerDelegate consumerDelegate = (ClientConsumerDelegate)invocation.invokeNext();
       DelegateSupport delegate = (DelegateSupport)consumerDelegate;
-      
+
       delegate.init();
-      
+
       SessionState sessionState = (SessionState)getState(invocation);
-      
+
       MethodInvocation mi = (MethodInvocation)invocation;
       Destination dest = (Destination)mi.getArguments()[0];
       String selector = (String)mi.getArguments()[1];
@@ -152,13 +153,13 @@
       boolean connectionConsumer = ((Boolean)mi.getArguments()[4]).booleanValue();
 
       int consumerID = consumerDelegate.getID();
-      
+
       int prefetchSize = consumerDelegate.getPrefetchSize();
-      
+
       int maxDeliveries = consumerDelegate.getMaxDeliveries();
-      
+
       long channelId = consumerDelegate.getChannelId();
-      
+
       ConsumerState consumerState =
          new ConsumerState(sessionState, consumerDelegate, dest, selector, noLocal,
                            subscriptionName, consumerID, connectionConsumer, prefetchSize,
@@ -167,63 +168,63 @@
       delegate.setState(consumerState);
       return consumerDelegate;
    }
-   
+
    public Object handleCreateProducerDelegate(Invocation invocation) throws Throwable
    {
       // ProducerDelegates are not created on the server
-      
+
       ProducerDelegate producerDelegate = new ClientProducerDelegate();
       DelegateSupport delegate = (DelegateSupport)producerDelegate;
-            
+
       SessionState sessionState = (SessionState)getState(invocation);
-      
+
       MethodInvocation mi = (MethodInvocation)invocation;
       Destination dest = ((Destination)mi.getArguments()[0]);
-      
 
+
       ProducerState producerState = new ProducerState(sessionState, producerDelegate, dest);
-      
+
       delegate.setState(producerState);
 
       // send an arbitrary invocation into the producer delegate, this will trigger AOP stack
       // initialization and AOP aspect class loading, using the "good" class loader, which is set
       // now. This will save us from having to switch the thread context class loader on every send.
       producerDelegate.getDeliveryMode();
-      
+
       return producerDelegate;
    }
-   
+
    public Object handleCreateBrowserDelegate(Invocation invocation) throws Throwable
    {
       MethodInvocation mi = (MethodInvocation)invocation;
 
       BrowserDelegate browserDelegate = (BrowserDelegate)invocation.invokeNext();
       DelegateSupport delegate = (DelegateSupport)browserDelegate;
-      
+
       delegate.init();
-      
+
       SessionState sessionState = (SessionState)getState(invocation);
 
       JBossDestination destination = (JBossDestination)mi.getArguments()[0];
       String selector = (String)mi.getArguments()[1];
 
       BrowserState state = new BrowserState(sessionState, browserDelegate, destination, selector);
-      
+
       delegate.setState(state);
       return browserDelegate;
    }
-      
+
    // Protected ------------------------------------------------------
 
    // Package Private ------------------------------------------------
 
    // Private --------------------------------------------------------
-   
+
    private HierarchicalState getState(Invocation inv)
    {
       return ((DelegateSupport)inv.getTargetObject()).getState();
    }
-   
+
    // Inner Classes --------------------------------------------------
 }
 

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java	2006-12-14 06:09:44 UTC (rev 1787)
@@ -56,7 +56,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private int serverId;
+   private int serverID;
 
    private transient JMSRemotingConnection remotingConnection;
    
@@ -70,7 +70,7 @@
    {
       super(objectID);
       
-      this.serverId = serverId;
+      this.serverID = serverId;
    }
 
    public ClientConnectionDelegate()
@@ -217,7 +217,7 @@
 
    public String toString()
    {
-      return "ConnectionDelegate[" + id + "]";
+      return "ConnectionDelegate[" + id + ", " + serverID + "]";
    }
 
    public void init()
@@ -235,9 +235,9 @@
       return remotingConnection;
    }
    
-   public int getServerId()
+   public int getServerID()
    {
-      return serverId;
+      return serverID;
    }
    
    public Version getVersionToUse()

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2006-12-14 06:09:44 UTC (rev 1787)
@@ -71,7 +71,7 @@
  
    private Version serverVersion;
  
-   private int serverId;
+   private int serverID;
    
    private boolean clientPing;
    
@@ -110,7 +110,7 @@
    {
       super(objectID);
 
-      this.serverId = serverId;
+      this.serverID = serverId;
       this.serverLocatorURI = serverLocatorURI;
       this.serverVersion = serverVersion;
       this.clientPing = clientPing;
@@ -294,7 +294,7 @@
 
    public String toString()
    {
-      return "ClientConnectionFactoryDelegate[" + id + "]";
+      return "ClientConnectionFactoryDelegate[" + id + ", " + serverID + "]";
    }
    
    public String getServerLocatorURI()
@@ -302,9 +302,9 @@
       return serverLocatorURI;
    }
 
-   public int getServerId()
+   public int getServerID()
    {
-      return serverId;
+      return serverID;
    }
    
    public boolean getClientPing()

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClusteredClientConnectionFactoryDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClusteredClientConnectionFactoryDelegate.java	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClusteredClientConnectionFactoryDelegate.java	2006-12-14 06:09:44 UTC (rev 1787)
@@ -56,7 +56,8 @@
 
    // Constructors --------------------------------------------------
 
-   public ClusteredClientConnectionFactoryDelegate(int objectID, int serverId, String serverLocatorURI,
+   public ClusteredClientConnectionFactoryDelegate(int objectID, int serverId,
+                                                   String serverLocatorURI,
                                                    Version serverVersion, boolean clientPing,
                                                    ClientConnectionFactoryDelegate[] delegates,
                                                    Map failoverMap)
@@ -66,14 +67,16 @@
       this.failoverMap = failoverMap;
    }
 
-   // Some of the properties of ClientConnectionFactoryDelegate are not exposed..
+   // Some of the properties of ClientConnectionFactoryDelegate are not exposed.
    // I didn't want to expose then while I needed another delegate's properties to perform a copy.
-   // So, I created this Constructor so I could have access into protected members inside an extension class
+   // So, I created this Constructor so I could have access into protected members inside an
+   // extension class.
+
    public ClusteredClientConnectionFactoryDelegate(ClientConnectionFactoryDelegate mainDelegate,
                                                    ClientConnectionFactoryDelegate[] delegates,
                                                    Map failoverMap)
    {
-      this(mainDelegate.getID(), mainDelegate.getServerId(), mainDelegate.getServerLocatorURI(),
+      this(mainDelegate.getID(), mainDelegate.getServerID(), mainDelegate.getServerLocatorURI(),
            mainDelegate.getServerVersion(), mainDelegate.getClientPing(), delegates, failoverMap);
    }
 
@@ -94,8 +97,6 @@
 
    // Public --------------------------------------------------------
 
-
-   // Only be used in testing
    public ClientConnectionFactoryDelegate[] getDelegates()
    {
       return delegates;
@@ -122,11 +123,19 @@
       sb.append(id).append("][");
       if (delegates == null)
       {
-         sb.append("0]");
+         sb.append("-]");
       }
       else
       {
-         sb.append(delegates.length).append("]");
+         for(int i = 0; i < delegates.length; i++)
+         {
+            sb.append(delegates[i].getServerID());
+            if (i < delegates.length - 1)
+            {
+               sb.append(',');
+            }
+         }
+         sb.append("]");
       }
       return sb.toString();
    }

Modified: trunk/src/main/org/jboss/jms/client/state/ConnectionState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/ConnectionState.java	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/src/main/org/jboss/jms/client/state/ConnectionState.java	2006-12-14 06:09:44 UTC (rev 1787)
@@ -26,6 +26,7 @@
 import javax.jms.ExceptionListener;
 
 import org.jboss.jms.client.delegate.DelegateSupport;
+import org.jboss.jms.client.delegate.ClientConnectionDelegate;
 import org.jboss.jms.client.remoting.JMSRemotingConnection;
 import org.jboss.jms.delegate.ConnectionDelegate;
 import org.jboss.jms.message.MessageIdGenerator;
@@ -89,21 +90,19 @@
    {
       super(null, (DelegateSupport)delegate);
 
-      if (log.isTraceEnabled()) { log.trace("Creating connection state"); }
+      if (log.isTraceEnabled()) { log.trace(this + " constructing connection state"); }
 
       children = new SyncSet(new HashSet(), new WriterPreferenceReadWriteLock());
 
       this.remotingConnection = remotingConnection;
-
       this.versionToUse = versionToUse;
 
-      //Each connection has it's own resource manager
-      //If we can failover all connections with the same server id at the same time
-      //then we can maintain one rm per unique server as opposed to per connection
+      // Each connection has its own resource manager. If we can failover all connections with the
+      // same server id at the same time then we can maintain one rm per unique server as opposed to
+      // per connection.
       this.resourceManager = new ResourceManager();
 
       this.idGenerator = gen;
-
       this.serverID = serverID;
    }
 
@@ -246,4 +245,9 @@
        
        this.delegate = newState.delegate;
     }
+
+   public String toString()
+   {
+      return "ConnectionState[" + ((ClientConnectionDelegate)delegate).getID() + "]";
+   }
 }

Modified: trunk/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/ServerPeer.java	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/src/main/org/jboss/jms/server/ServerPeer.java	2006-12-14 06:09:44 UTC (rev 1787)
@@ -738,11 +738,11 @@
    {
       //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);
+      log.info(this + " waiting for server-side failover from failed node " + failedNodeId);
       
       Replicator replicator = getReplicator();
       
-      //Failover
+      // Failover
 
       long startToWait = failoverStartTimeout;
       

Modified: trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2006-12-14 06:09:44 UTC (rev 1787)
@@ -422,7 +422,7 @@
       {
          ClientConnectionFactoryDelegate del = (ClientConnectionFactoryDelegate)i.next();
             
-          if (del.getServerId() == this.serverPeer.getServerPeerID())
+          if (del.getServerID() == this.serverPeer.getServerPeerID())
           {
              // sanity check
              if (mainDelegate != null)

Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java	2006-12-14 06:09:44 UTC (rev 1787)
@@ -94,27 +94,30 @@
 
    // ConnectionFactoryDelegate implementation ----------------------
    
-   public CreateConnectionResult createConnectionDelegate(String username, String password,
-                                                          int failedNodeId)
+   public CreateConnectionResult createConnectionDelegate(String username,
+                                                          String password,
+                                                          int failedNodeID)
       throws JMSException      
    {
       try
       {
-         if (failedNodeId == -1)
+         if (failedNodeID == -1)
          {
-            //Just a standard createConnection
+            // Just a standard createConnection
             return new CreateConnectionResult(createConnectionDelegateInternal(username, password));            
          }
          else
          {
-            //Failover
-            //Wait for server side failover to complete
-            int failoverNodeId = serverPeer.waitForFailover(failedNodeId);
+            log.debug(this + " creating a failover connection " +
+                      "to replace connection to failed node " + failedNodeID);
+
+            // Wait for server side failover to complete
+            int failoverNodeID = serverPeer.waitForFailover(failedNodeID);
             
-            if (failoverNodeId == -1 || failoverNodeId != serverPeer.getServerPeerID())
+            if (failoverNodeID == -1 || failoverNodeID != serverPeer.getServerPeerID())
             {
                //We are on the wrong node - or no failover has occurred
-               return new CreateConnectionResult(failoverNodeId);
+               return new CreateConnectionResult(failoverNodeID);
             }
             else
             {
@@ -206,6 +209,11 @@
       return jndiBindings;
    }
 
+   public String toString()
+   {
+      return "ConnectionFactoryEndpoint[" + id + "]";
+   }
+
    // Package protected ---------------------------------------------
    
    // Protected -----------------------------------------------------

Modified: trunk/src/main/org/jboss/messaging/core/ChannelSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/ChannelSupport.java	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/src/main/org/jboss/messaging/core/ChannelSupport.java	2006-12-14 06:09:44 UTC (rev 1787)
@@ -733,7 +733,7 @@
             if (persist && ref.isReliable() && recoverable)
             {
                // Reliable message in a recoverable state - also add to db
-               if (trace) { log.trace(this + "adding " + ref + " to database non-transactionally"); }
+               if (trace) { log.trace(this + " adding " + ref + " to database non-transactionally"); }
 
                pm.addReference(channelID, ref, null);        
             }
@@ -753,7 +753,7 @@
          }
          else
          {
-            if (trace) { log.trace(this + "adding " + ref + " to state " + (tx == null ? "non-transactionally" : "in transaction: " + tx)); }
+            if (trace) { log.trace(this + " adding " + ref + " to state " + (tx == null ? "non-transactionally" : "in transaction: " + tx)); }
 
             if (ref.isReliable() && !acceptReliableMessages)
             {
@@ -776,7 +776,7 @@
             if (persist && ref.isReliable() && recoverable)
             {
                // Reliable message in a recoverable state - also add to db
-               if (trace) { log.trace(this + "adding " + ref + (tx == null ? " to database non-transactionally" : " in transaction: " + tx)); }
+               if (trace) { log.trace(this + " adding " + ref + (tx == null ? " to database non-transactionally" : " in transaction: " + tx)); }
 
                pm.addReference(channelID, ref, tx);
             }

Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java	2006-12-14 06:09:44 UTC (rev 1787)
@@ -41,7 +41,6 @@
 import java.util.Properties;
 import java.util.Set;
 
-import javax.jms.TextMessage;
 import javax.sql.DataSource;
 import javax.transaction.TransactionManager;
 import javax.management.NotificationBroadcasterSupport;
@@ -693,15 +692,8 @@
    public void routeFromCluster(org.jboss.messaging.core.Message message, String routingKeyText,
                                 Map queueNameNodeIdMap) throws Exception
    {
-      if (trace)
-      {
-         log.trace(this.currentNodeId + " routing from cluster, message: " + message + " routing key " +
-                  routingKeyText + " map " + queueNameNodeIdMap);
-      }
+      if (trace) { log.trace(this + " routing from cluster " + message + ", routing key " + routingKeyText + ", map " + queueNameNodeIdMap); }
 
-      log.info(this.currentNodeId + " routing from cluster, message: " + message + " routing key " +
-               routingKeyText + " map " + queueNameNodeIdMap);
-
       Condition routingKey = conditionFactory.createCondition(routingKeyText);
 
       lock.readLock().acquire();
@@ -1136,20 +1128,8 @@
 
    public boolean route(MessageReference ref, Condition condition, Transaction tx) throws Exception
    {
-      if (trace) { log.trace(this.currentNodeId + " Routing " + ref + " with condition " + condition + " and transaction " + tx); }
+      if (trace) { log.trace(this + " routing " + ref + " with condition '" + condition + "'" + (tx == null ? "" : " transactionally in " + tx)); }
 
-      //debug
-      try
-      {
-         TextMessage tm = (TextMessage)ref.getMessage();
-
-         log.info(this.currentNodeId + " *********** Routing ref: " + tm.getText() + " with condition " + condition + " and transaction " + tx);
-      }
-      catch (Exception e)
-      {
-         e.printStackTrace();
-      }
-
       if (ref == null)
       {
          throw new IllegalArgumentException("Message reference is null");
@@ -1174,19 +1154,22 @@
 
          if (cb != null)
          {
+            if (trace) { log.trace(this + " found clustered bindings " + cb); }
+
             if (tx == null && ref.isReliable())
             {
-               if (!(cb.getDurableCount() == 0 || (cb.getDurableCount() == 1 && cb.getLocalDurableCount() == 1)))
+               if (!(cb.getDurableCount() == 0 ||
+                    (cb.getDurableCount() == 1 && cb.getLocalDurableCount() == 1)))
                {
                   // When routing a persistent message without a transaction then we may need to
                   // start an internal transaction in order to route it. This is so we can guarantee
                   // the message is delivered to all or none of the subscriptions. We need to do
-                  // this if there is anything other than. No durable subs or exactly one local
-                  // durable sub.
+                  // this if there is anything other than. No durable subscriptions or exactly one
+                  // local durable subscription.
 
                   startInternalTx = true;
 
-                  if (trace) { log.trace(this.currentNodeId + " Starting internal transaction since more than one durable sub or remote durable subs"); }
+                  if (trace) { log.trace(this + " starting internal transaction since it needs to deliver persistent message to more than one durable sub or remote durable subs"); }
                }
             }
 
@@ -1217,17 +1200,14 @@
 
                   ClusteredQueue queue = (ClusteredQueue)del.getObserver();
 
-                  if (trace) { log.trace(this.currentNodeId + " Routing message to queue or stub:" + queue.getName() + " on node " + queue.getNodeId() + " local:" + queue.isLocal()); }
+                  if (trace) { log.trace(this + " successfully routed message to " + (queue.isLocal() ? "local"  : "remote")+ " destination '" + queue.getName() + "' on node " + queue.getNodeId()); }
 
-                  log.info(this.currentNodeId + " Routing message to queue or stub:" +
-                           queue.getName() + " on node " + queue.getNodeId() + " local:" +
-                           queue.isLocal());
-
                   if (router.numberOfReceivers() > 1)
                   {
-                     //We have now chosen which one will receive the message so we need to add this
-                     //information to a map which will get sent when casting - so the the queue
-                     //on the receiving node knows whether to receive the message
+                     // We have now chosen which one will receive the message so we need to add this
+                     // information to a map which will get sent when casting - so the the queue on
+                     // the receiving node knows whether to receive the message.
+
                      if (queueNameNodeIdMap == null)
                      {
                         queueNameNodeIdMap = new HashMap();
@@ -1238,40 +1218,42 @@
 
                   if (!queue.isLocal())
                   {
-                     //We need to send the message remotely
+                     // We need to send the message remotely
                      numberRemote++;
 
                      lastNodeId = queue.getNodeId();
-
                      lastChannelId = queue.getChannelID();
                   }
                }
             }
 
-            //Now we've sent the message to any local queues, we might also need
-            //to send the message to the other office instances on the cluster if there are
-            //queues on those nodes that need to receive the message
+            // Now we've sent the message to any local queues, we might also need to send the
+            // message to the other office instances on the cluster if there are queues on those
+            // nodes that need to receive the message.
 
-            //TODO - there is an innefficiency here, numberRemote does not take into account that more than one
-            //of the number remote may be on the same node, so we could end up multicasting
-            //when unicast would do
+            //TODO - there is an innefficiency here, numberRemote does not take into account that
+            //       more than one of the number remote may be on the same node, so we could end up
+            //       multicasting when unicast would do
+
             if (numberRemote > 0)
             {
                if (tx == null)
                {
                   if (numberRemote == 1)
                   {
-                     if (trace) { log.trace(this.currentNodeId + " unicasting message to " + lastNodeId); }
+                     if (trace) { log.trace(this + " unicasting message to " + lastNodeId); }
 
-                     //Unicast - only one node is interested in the message
-                     asyncSendRequest(new MessageRequest(condition.toText(), ref.getMessage(), null), lastNodeId);
+                     // Unicast - only one node is interested in the message
+                     asyncSendRequest(new MessageRequest(condition.toText(),
+                                                         ref.getMessage(), null), lastNodeId);
                   }
                   else
                   {
-                     if (trace) { log.trace(this.currentNodeId + " multicasting message to group"); }
+                     if (trace) { log.trace(this + " multicasting message to group"); }
 
-                     //Multicast - more than one node is interested
-                     asyncSendRequest(new MessageRequest(condition.toText(), ref.getMessage(), queueNameNodeIdMap));
+                     // Multicast - more than one node is interested
+                     asyncSendRequest(new MessageRequest(condition.toText(),
+                                                         ref.getMessage(), queueNameNodeIdMap));
                   }
                }
                else
@@ -1280,30 +1262,35 @@
 
                   if (callback == null)
                   {
-                     callback = new CastMessagesCallback(currentNodeId, tx.getId(), DefaultClusteredPostOffice.this, failBeforeCommit, failAfterCommit);
+                     callback = new CastMessagesCallback(currentNodeId, tx.getId(),
+                                                         DefaultClusteredPostOffice.this,
+                                                         failBeforeCommit, failAfterCommit);
 
-                     //This callback MUST be executed first
+                     // This callback MUST be executed first
 
-                     //Execution order is as follows:
-                     //Before commit:
-                     //1. Cast messages across network - get added to holding area (if persistent) on receiving
-                     //nodes
-                     //2. Persist messages in persistent store
-                     //After commit
-                     //1. Cast commit message across network
+                     // Execution order is as follows:
+                     //
+                     // Before commit:
+                     // 1. Cast messages across network - get added to holding area (if persistent)
+                     //    on receiving nodes.
+                     // 2. Persist messages in persistent store.
+                     //
+                     // After commit
+                     //
+                     // 1. Cast commit message across network.
+
                      tx.addFirstCallback(callback, this);
                   }
 
                   callback.addMessage(condition, ref.getMessage(), queueNameNodeIdMap,
-                                      numberRemote == 1 ? lastNodeId : -1,
-                                      lastChannelId);
+                                      numberRemote == 1 ? lastNodeId : -1, lastChannelId);
                }
             }
 
             if (startInternalTx)
             {
                tx.commit();
-               if (trace) { log.trace("Committed internal transaction"); }
+               if (trace) { log.trace(this + " committed internal transaction"); }
             }
          }
       }

Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java	2006-12-14 06:09:44 UTC (rev 1787)
@@ -25,8 +25,6 @@
 import java.util.Iterator;
 import java.util.List;
 
-import javax.jms.TextMessage;
-
 import org.jboss.logging.Logger;
 import org.jboss.messaging.core.Delivery;
 import org.jboss.messaging.core.DeliveryObserver;
@@ -50,11 +48,17 @@
  */
 public class DefaultRouter implements ClusterRouter
 {
+   // Constants -----------------------------------------------------
+
    private static final Logger log = Logger.getLogger(DefaultRouter.class);
-   
+
+   // Static --------------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
    private boolean trace = log.isTraceEnabled();
-      
-   //MUST be an arraylist for fast index access
+
+   // MUST be an arraylist for fast index access
    private ArrayList nonLocalQueues;
 
    private ArrayList failedOverQueues;
@@ -63,63 +67,84 @@
 
    private int target;
 
+   // Constructors --------------------------------------------------
+
    public DefaultRouter()
    {
       nonLocalQueues = new ArrayList();
       failedOverQueues = new ArrayList();
    }
 
-   public int size()
-   {
-      return nonLocalQueues.size() + (localQueue == null ? 0 : 1);
-   }
+   // Receiver implementation ---------------------------------------
 
-   public ClusteredQueue getLocalQueue()
+   public Delivery handle(DeliveryObserver observer, MessageReference reference, Transaction tx)
    {
-      return localQueue;
-   }
+      if (trace) { log.trace(this + " routing " + reference); }
 
-   public boolean add(Receiver receiver)
-   {
-      return add(receiver,false);
-   }
+      // Favour the local queue or the failedOver queue in round robin
 
-   public boolean add(Receiver receiver, boolean failedOver)
-   {
-      ClusteredQueue queue = (ClusteredQueue)receiver;
+      if (!failedOverQueues.isEmpty())
+      {
+         if (trace) { log.trace(this + " round robin on failedover queue, current target " + target);}
 
-      if (queue.isLocal())
-      {
-         if (failedOver)
+         LocalClusteredQueue queueToUse = null;
+
+         if (target == -1)
          {
-            failedOverQueues.add(receiver);
+            queueToUse = (LocalClusteredQueue)this.localQueue;
          }
          else
          {
-            if (localQueue != null)
-            {
-               throw new IllegalStateException("Already has local queue");
-            }
-            localQueue = queue;
+            queueToUse = (LocalClusteredQueue)failedOverQueues.get(target);
          }
+
+         incTargetFailedOver();
+
+         Delivery del = queueToUse.handle(observer, reference, tx);
+
+         if (trace) { log.trace(this + " routed to failed queue, using failedOver round robbing, returned " + del); }
+
+         return del;
       }
+      else if (localQueue != null)
+      {
+         // The only time the local queue won't accept is if the selector doesn't match, in which
+         // case it won't match at any other nodes too so no point in trying them
+
+         Delivery del = localQueue.handle(observer, reference, tx);
+
+         if (trace) { log.trace(this + " routed to local queue, it returned " + del); }
+
+         return del;
+      }
       else
       {
-         nonLocalQueues.add(queue);
-      }
+         // There is no local shared queue. We round robin among the rest.
 
-      return true;
-   }
+         if (!nonLocalQueues.isEmpty())
+         {
+            ClusteredQueue queue = (ClusteredQueue)nonLocalQueues.get(target);
 
-   public void clear()
-   {
-      nonLocalQueues.clear();
+            Delivery del = queue.handle(observer, reference, tx);
 
-      localQueue = null;
+            if (trace) { log.trace(this + " routed to remote queue, it returned " + del); }
 
-      target = 0;
+            incTarget();
+
+            // Again, if the selector doesn't match then it won't on any others so no point trying
+            // them.
+
+            return del;
+         }
+      }
+
+      if (trace) { log.trace(this + " no queues to route to so return null"); }
+
+      return null;
    }
 
+   // Distributor implementation ------------------------------------
+
    public boolean contains(Receiver queue)
    {
       return localQueue == queue || nonLocalQueues.contains(queue);
@@ -139,6 +164,11 @@
       return queues.iterator();
    }
 
+   public boolean add(Receiver receiver)
+   {
+      return add(receiver,false);
+   }
+
    public boolean remove(Receiver queue)
    {
       if (localQueue == queue)
@@ -164,88 +194,90 @@
       }
    }
 
-   public Delivery handle(DeliveryObserver observer, MessageReference reference, Transaction tx)
+   public void clear()
    {
-      if (trace) { log.trace(this + " routing ref " + reference); }
+      nonLocalQueues.clear();
+      localQueue = null;
+      target = 0;
+   }
 
-      //Favour the local queue or the failedOver queue in round robin
+   public int numberOfReceivers()
+   {
+      return nonLocalQueues.size() + (localQueue != null ? 1 : 0);
+   }
 
-      if (!failedOverQueues.isEmpty())
+
+   // ClusterRouter implementation ----------------------------------
+
+   public List getQueues()
+   {
+      List queues = new ArrayList();
+
+      if (localQueue != null)
       {
-         if (trace) { log.trace("Round robin on FailedOver queue, currentTarget=" + target);}
-         
-         LocalClusteredQueue queueToUse = null;
+         queues.add(localQueue);
+      }
 
-         if (target == -1)
-         {
-            queueToUse = (LocalClusteredQueue)this.localQueue; 
-         }
-         else
-         {
-            queueToUse = (LocalClusteredQueue)failedOverQueues.get(target);
-         }
+      queues.addAll(nonLocalQueues);
 
-         incTargetFailedOver();
-         
-         log.info("***************** Routing to failed over queue");
-         Delivery del = queueToUse.handle(observer, reference, tx);
+      return queues;
+   }
 
-         if (trace) { log.trace(this+" routed to failed queue, using failedOver round robbing, returned " + del); }
-         
-         return del;
-      }
-      else if (localQueue != null)
+   public List getFailedQueues()
+   {
+      return failedOverQueues;
+   }
+
+   public ClusteredQueue getLocalQueue()
+   {
+      return localQueue;
+   }
+
+   public boolean add(Receiver receiver, boolean failedOver)
+   {
+      ClusteredQueue queue = (ClusteredQueue)receiver;
+
+      if (queue.isLocal())
       {
-         //The only time the local queue won't accept is if the selector doesn't
-         //match - in which case it won't match at any other nodes too so no point
-         //in trying them
-         
-         //debug
-         try
+         if (failedOver)
          {
-            TextMessage tm = (TextMessage)reference.getMessage();
-            
-            log.info("*********** Routing to local queue: " + tm.getText() + " id:" + System.identityHashCode(localQueue) );
+            failedOverQueues.add(receiver);
          }
-         catch (Exception e)
+         else
          {
-            e.printStackTrace();
+            if (localQueue != null)
+            {
+               throw new IllegalStateException("Already has local queue");
+            }
+            localQueue = queue;
          }
-
-         Delivery del = localQueue.handle(observer, reference, tx);
-
-         if (trace) { log.trace(this + " routed to local queue, it returned " + del); }
-
-         return del;
       }
       else
       {
-         //There is no local shared queue
-         //We round robin among the rest
+         nonLocalQueues.add(queue);
+      }
 
-         if (!nonLocalQueues.isEmpty())
-         {
-            ClusteredQueue queue = (ClusteredQueue)nonLocalQueues.get(target);
+      return true;
+   }
 
-            queue = (ClusteredQueue)nonLocalQueues.get(target);
+   // Public --------------------------------------------------------
 
-            log.info("************ Routing to non local queue");
-            Delivery del = queue.handle(observer, reference, tx);
+   public int size()
+   {
+      return nonLocalQueues.size() + (localQueue == null ? 0 : 1);
+   }
 
-            if (trace) { log.trace(this + " routed to remote queue, it returned " + del); }
+   public String toString()
+   {
+      return "DefaultRouter[" + Integer.toHexString(hashCode()) + "]";
+   }
 
-            incTarget();
+   // Package protected ---------------------------------------------
 
-            //Again, if the selector doesn't match then it won't on any others so no point trying them
-            return del;
-         }
-      }
+   // Protected -----------------------------------------------------
 
-      if (trace) { log.trace(this + " no queues to route to so return null"); }
+   // Private -------------------------------------------------------
 
-      return null;
-   }
-
    private void incTargetFailedOver()
    {
       target++;
@@ -267,30 +299,8 @@
       }
    }
 
+   // Inner classes -------------------------------------------------
 
-   public java.util.List getFailedQueues()
-   {
-      return failedOverQueues;
-   }
-
-   public List getQueues()
-   {
-      List queues = new ArrayList();
-
-      if (localQueue != null)
-      {
-         queues.add(localQueue);
-      }
-
-      queues.addAll(nonLocalQueues);
-
-      return queues;
-   }
-
-   public int numberOfReceivers()
-   {
-      return nonLocalQueues.size() + (localQueue != null ? 1 : 0);
-   }
 }
 
 

Modified: trunk/tests/etc/log4j.xml
===================================================================
--- trunk/tests/etc/log4j.xml	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/tests/etc/log4j.xml	2006-12-14 06:09:44 UTC (rev 1787)
@@ -42,7 +42,7 @@
    </category>
 
    <category name="org.jboss.remoting">
-         <priority value="TRACE"/>
+      <priority value="INFO"/>
    </category>
 
    <category name="org.jboss">

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java	2006-12-14 06:09:44 UTC (rev 1787)
@@ -59,7 +59,7 @@
 
          conn.close();
 
-         // create a connection to a node we'll kill soon
+         // create a connection to a node we'll kill soon (node 1)
 
          conn = cf.createConnection();
          s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -74,6 +74,8 @@
 
          assertEquals(1, nodeID);
 
+         log.info("consumer created");
+
          // kill node 1
 
          ServerManagement.kill(1);
@@ -84,7 +86,7 @@
 
          // TODO - this shouldn't be necessary if we have the client valve in place
          log.info("Sleeping for 1 min");
-         Thread.sleep(30000);
+         Thread.sleep(20000);
 
          // we must receive the message
 

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java	2006-12-13 23:29:14 UTC (rev 1786)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java	2006-12-14 06:09:44 UTC (rev 1787)
@@ -93,11 +93,11 @@
       
       ClientConnectionFactoryDelegate cf3 = delegate.getDelegates()[2];
       
-      assertEquals(0, cf1.getServerId());
+      assertEquals(0, cf1.getServerID());
       
-      assertEquals(1, cf2.getServerId());
+      assertEquals(1, cf2.getServerID());
       
-      assertEquals(2, cf3.getServerId());
+      assertEquals(2, cf3.getServerID());
       
       assertEquals(3, ServerManagement.getServer(0).getNodeIDView().size());
       
@@ -219,18 +219,18 @@
          
          //If any servers get stopped and then started then the order will change
     
-         log.info("cf1 serverid=" + cf1.getServerId());
+         log.info("cf1 serverid=" + cf1.getServerID());
          
-         log.info("cf2 serverid=" + cf2.getServerId());
+         log.info("cf2 serverid=" + cf2.getServerID());
          
-         log.info("cf3 serverid=" + cf3.getServerId());
+         log.info("cf3 serverid=" + cf3.getServerID());
          
          
-         assertEquals(0, cf1.getServerId());
+         assertEquals(0, cf1.getServerID());
          
-         assertEquals(1, cf2.getServerId());
+         assertEquals(1, cf2.getServerID());
          
-         assertEquals(2, cf3.getServerId());
+         assertEquals(2, cf3.getServerID());
          
          Map failoverMap = delegate.getFailoverMap();
          
@@ -240,11 +240,11 @@
          
          // Default failover policy just chooses the node to the right
          
-         assertEquals(cf2.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
+         assertEquals(cf2.getServerID(), ((Integer)failoverMap.get(new Integer(cf1.getServerID()))).intValue());
          
-         assertEquals(cf3.getServerId(), ((Integer)failoverMap.get(new Integer(cf2.getServerId()))).intValue());
+         assertEquals(cf3.getServerID(), ((Integer)failoverMap.get(new Integer(cf2.getServerID()))).intValue());
          
-         assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf3.getServerId()))).intValue());
+         assertEquals(cf1.getServerID(), ((Integer)failoverMap.get(new Integer(cf3.getServerID()))).intValue());
       }
       
       //Now cleanly stop one of the servers
@@ -280,20 +280,20 @@
          
          //Order here depends on order servers were started in
          
-         log.info("cf1 serverid=" + cf1.getServerId());
+         log.info("cf1 serverid=" + cf1.getServerID());
          
-         log.info("cf2 serverid=" + cf2.getServerId());
+         log.info("cf2 serverid=" + cf2.getServerID());
          
-         assertEquals(1, cf1.getServerId());
+         assertEquals(1, cf1.getServerID());
          
-         assertEquals(2, cf2.getServerId());
+         assertEquals(2, cf2.getServerID());
          
          
          assertEquals(2, failoverMap.size());
          
-         assertEquals(cf2.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
+         assertEquals(cf2.getServerID(), ((Integer)failoverMap.get(new Integer(cf1.getServerID()))).intValue());
          
-         assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf2.getServerId()))).intValue());
+         assertEquals(cf1.getServerID(), ((Integer)failoverMap.get(new Integer(cf2.getServerID()))).intValue());
       }
       
       //Cleanly stop another server
@@ -320,12 +320,12 @@
          
          ClientConnectionFactoryDelegate cf1 = delegate.getDelegates()[0];
          
-         assertEquals(2, cf1.getServerId());
+         assertEquals(2, cf1.getServerID());
          
          
          assertEquals(1, failoverMap.size());
          
-         assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
+         assertEquals(cf1.getServerID(), ((Integer)failoverMap.get(new Integer(cf1.getServerID()))).intValue());
       }
             
       //Restart server 0
@@ -352,20 +352,20 @@
          
          ClientConnectionFactoryDelegate cf2 = delegate.getDelegates()[1];
          
-         log.info("cf1 serverid=" + cf1.getServerId());
+         log.info("cf1 serverid=" + cf1.getServerID());
          
-         log.info("cf2 serverid=" + cf2.getServerId());
+         log.info("cf2 serverid=" + cf2.getServerID());
          
-         assertEquals(2, cf1.getServerId());
+         assertEquals(2, cf1.getServerID());
          
-         assertEquals(0, cf2.getServerId());
+         assertEquals(0, cf2.getServerID());
          
          
          assertEquals(2, failoverMap.size());
          
-         assertEquals(cf2.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
+         assertEquals(cf2.getServerID(), ((Integer)failoverMap.get(new Integer(cf1.getServerID()))).intValue());
          
-         assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf2.getServerId()))).intValue());
+         assertEquals(cf1.getServerID(), ((Integer)failoverMap.get(new Integer(cf2.getServerID()))).intValue());
       }
       
       
@@ -395,26 +395,26 @@
          
          ClientConnectionFactoryDelegate cf3 = delegate.getDelegates()[2];
          
-         log.info("cf1 serverid=" + cf1.getServerId());
+         log.info("cf1 serverid=" + cf1.getServerID());
          
-         log.info("cf2 serverid=" + cf2.getServerId());
+         log.info("cf2 serverid=" + cf2.getServerID());
          
-         log.info("cf3 serverid=" + cf3.getServerId());
+         log.info("cf3 serverid=" + cf3.getServerID());
          
-         assertEquals(2, cf1.getServerId());
+         assertEquals(2, cf1.getServerID());
          
-         assertEquals(0, cf2.getServerId());
+         assertEquals(0, cf2.getServerID());
          
-         assertEquals(1, cf3.getServerId());
+         assertEquals(1, cf3.getServerID());
          
          
          assertEquals(3, failoverMap.size());
          
-         assertEquals(cf2.getServerId(), ((Integer)failoverMap.get(new Integer(cf1.getServerId()))).intValue());
+         assertEquals(cf2.getServerID(), ((Integer)failoverMap.get(new Integer(cf1.getServerID()))).intValue());
          
-         assertEquals(cf3.getServerId(), ((Integer)failoverMap.get(new Integer(cf2.getServerId()))).intValue());
+         assertEquals(cf3.getServerID(), ((Integer)failoverMap.get(new Integer(cf2.getServerID()))).intValue());
          
-         assertEquals(cf1.getServerId(), ((Integer)failoverMap.get(new Integer(cf3.getServerId()))).intValue());
+         assertEquals(cf1.getServerID(), ((Integer)failoverMap.get(new Integer(cf3.getServerID()))).intValue());
       }            
    }
    
@@ -436,11 +436,11 @@
       
       ClientConnectionFactoryDelegate cf3 = delegates[2];
       
-      int server0Id = cf1.getServerId();
+      int server0Id = cf1.getServerID();
       
-      int server1Id = cf2.getServerId();
+      int server1Id = cf2.getServerID();
       
-      int server2Id = cf3.getServerId();
+      int server2Id = cf3.getServerID();
       
       log.info("server 0 id: " + server0Id);
       
@@ -571,11 +571,11 @@
       
       ClientConnectionFactoryDelegate cf3 = delegates[2];
       
-      int server0Id = cf1.getServerId();
+      int server0Id = cf1.getServerID();
       
-      int server1Id = cf2.getServerId();
+      int server1Id = cf2.getServerID();
       
-      int server2Id = cf3.getServerId();
+      int server2Id = cf3.getServerID();
       
       log.info("server 0 id: " + server0Id);
       
@@ -742,11 +742,11 @@
       
       ClientConnectionFactoryDelegate cf3 = delegates[2];
       
-      int server0Id = cf1.getServerId();
+      int server0Id = cf1.getServerID();
       
-      int server1Id = cf2.getServerId();
+      int server1Id = cf2.getServerID();
       
-      int server2Id = cf3.getServerId();
+      int server2Id = cf3.getServerID();
       
       log.info("server 0 id: " + server0Id);
       




More information about the jboss-cvs-commits mailing list