[jboss-cvs] JBoss Messaging SVN: r2448 - in trunk: tests/src/org/jboss/test/messaging/jms/clustering and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 26 08:18:42 EST 2007


Author: ovidiu.feodorov at jboss.com
Date: 2007-02-26 08:18:42 -0500 (Mon, 26 Feb 2007)
New Revision: 2448

Modified:
   trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
   trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
   trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
   trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
Log:
extra logging, new test

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java	2007-02-26 12:50:17 UTC (rev 2447)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java	2007-02-26 13:18:42 UTC (rev 2448)
@@ -51,6 +51,7 @@
 import org.jboss.jms.wireformat.ConnectionStopRequest;
 import org.jboss.jms.wireformat.RequestSupport;
 import org.jboss.messaging.core.tx.MessagingXid;
+import org.jboss.logging.Logger;
 
 /**
  * The client-side Connection delegate class.
@@ -66,15 +67,17 @@
 public class ClientConnectionDelegate extends DelegateSupport implements ConnectionDelegate
 {
    // Constants ------------------------------------------------------------------------------------
-   
+
+   private static final Logger log = Logger.getLogger(ClientConnectionDelegate.class);
+
    // Attributes -----------------------------------------------------------------------------------
 
    private int serverID;
-   
+
    private transient JMSRemotingConnection remotingConnection;
-   
+
    private transient Version versionToUse;
-   
+
    // Static ---------------------------------------------------------------------------------------
 
    // Constructors ---------------------------------------------------------------------------------
@@ -82,7 +85,7 @@
    public ClientConnectionDelegate(int objectID, int serverID)
    {
       super(objectID);
-      
+
       this.serverID = serverID;
    }
 
@@ -94,10 +97,12 @@
 
    public void synchronizeWith(DelegateSupport nd) throws Exception
    {
+      log.debug(this + " synchronizing with " + nd);
+
       super.synchronizeWith(nd);
 
       ClientConnectionDelegate newDelegate = (ClientConnectionDelegate)nd;
-      
+
       // synchronize the server endpoint state
 
       // this is a bit counterintuitve, as we're not copying from new delegate, but modifying its
@@ -105,7 +110,7 @@
       // server
 
       ConnectionState thisState = (ConnectionState)state;
-      
+
       if (thisState.getClientID() != null)
       {
          newDelegate.setClientID(thisState.getClientID());
@@ -119,38 +124,38 @@
 
       remotingConnection = newDelegate.getRemotingConnection();
       versionToUse = newDelegate.getVersionToUse();
-      
+
       // There is one RM per server, so we need to merge the rms if necessary
       ResourceManagerFactory.instance.handleFailover(serverID, newDelegate.getServerID());
-      
+
       client = thisState.getRemotingConnection().getRemotingClient();
-      
+
       serverID = newDelegate.getServerID();
    }
-   
+
    public void setState(HierarchicalState state)
    {
       super.setState(state);
-                 
+
       client = ((ConnectionState)state).getRemotingConnection().getRemotingClient();
    }
 
    // Closeable implementation ---------------------------------------------------------------------
-   
+
    public void close() throws JMSException
    {
       RequestSupport req = new CloseRequest(id, version);
-      
+
       doInvoke(client, req);
    }
-   
+
    public void closing() throws JMSException
    {
       RequestSupport req = new ClosingRequest(id, version);
-      
+
       doInvoke(client, req);
    }
-   
+
    // ConnectionDelegate implementation ------------------------------------------------------------
 
    /**
@@ -174,15 +179,15 @@
          new ConnectionCreateSessionDelegateRequest(id, version, transacted,
                                                     acknowledgmentMode, isXA);
 
-      return (SessionDelegate)doInvoke(client, req);     
+      return (SessionDelegate)doInvoke(client, req);
    }
-  
 
+
    public String getClientID() throws JMSException
    {
       RequestSupport req = new ConnectionGetClientIDRequest(id, version);
-                     
-      return (String)doInvoke(client, req);      
+
+      return (String)doInvoke(client, req);
    }
 
    /**
@@ -208,14 +213,14 @@
    {
       RequestSupport req =
          new ConnectionSendTransactionRequest(id, version, request, checkForDuplicates);
-      
+
       doInvoke(client, req);
    }
 
    public void setClientID(String clientID) throws JMSException
    {
       RequestSupport req = new ConnectionSetClientIDRequest(id, version, clientID);
-      
+
       doInvoke(client, req);
    }
 
@@ -231,22 +236,22 @@
    public void start() throws JMSException
    {
       RequestSupport req = new ConnectionStartRequest(id, version);
-      
+
       doInvokeOneway(client, req);
    }
 
    public void stop() throws JMSException
    {
       RequestSupport req = new ConnectionStopRequest(id, version);
-      
+
       doInvoke(client, req);
    }
 
    public MessagingXid[] getPreparedTransactions() throws JMSException
    {
       RequestSupport req = new ConnectionGetPreparedTransactionsRequest(id, version);
-      
-      return (MessagingXid[])doInvoke(client, req);    
+
+      return (MessagingXid[])doInvoke(client, req);
    }
 
    /**
@@ -276,17 +281,17 @@
    {
       return remotingConnection;
    }
-   
+
    public int getServerID()
    {
       return serverID;
    }
-   
+
    public Version getVersionToUse()
    {
       return versionToUse;
    }
-   
+
    public void setVersionToUse(Version versionToUse)
    {
       this.versionToUse = versionToUse;
@@ -301,18 +306,18 @@
    // Protected ------------------------------------------------------------------------------------
 
    // Streamable implementation -------------------------------------------------------------------
-   
+
    public void read(DataInputStream in) throws Exception
    {
       super.read(in);
-      
+
       serverID = in.readInt();
    }
 
    public void write(DataOutputStream out) throws Exception
    {
       super.write(out);
-      
+
       out.writeInt(serverID);
    }
 

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java	2007-02-26 12:50:17 UTC (rev 2447)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java	2007-02-26 13:18:42 UTC (rev 2448)
@@ -37,6 +37,7 @@
 import org.jboss.jms.wireformat.ConsumerCancelInflightMessagesRequest;
 import org.jboss.jms.wireformat.ConsumerChangeRateRequest;
 import org.jboss.jms.wireformat.RequestSupport;
+import org.jboss.logging.Logger;
 
 /**
  * The client-side Consumer delegate class.
@@ -51,9 +52,11 @@
 public class ClientConsumerDelegate extends DelegateSupport implements ConsumerDelegate
 {
    // Constants ------------------------------------------------------------------------------------
-   
+
+   private static final Logger log = Logger.getLogger(ClientConsumerDelegate.class);
+
    // Attributes -----------------------------------------------------------------------------------
-   
+
    private int bufferSize;
    private int maxDeliveries;
 
@@ -67,15 +70,17 @@
       this.bufferSize = bufferSize;
       this.maxDeliveries = maxDeliveries;
    }
-   
+
    public ClientConsumerDelegate()
-   {      
+   {
    }
 
    // DelegateSupport overrides --------------------------------------------------------------------
 
    public void synchronizeWith(DelegateSupport nd) throws Exception
    {
+      log.debug(this + " synchronizing with " + nd);
+
       super.synchronizeWith(nd);
 
       ClientConsumerDelegate newDelegate = (ClientConsumerDelegate)nd;
@@ -92,46 +97,46 @@
       maxDeliveries = newDelegate.getMaxDeliveries();
 
       client = ((ConnectionState)state.getParent().getParent()).getRemotingConnection().
-         getRemotingClient();      
+         getRemotingClient();
    }
-   
+
    public void setState(HierarchicalState state)
    {
       super.setState(state);
-      
+
       client = ((ConnectionState)state.getParent().getParent()).getRemotingConnection().
                   getRemotingClient();
    }
 
    // Closeable implementation ---------------------------------------------------------------------
-   
+
    public void close() throws JMSException
    {
       RequestSupport req = new CloseRequest(id, version);
-      
+
       doInvoke(client, req);
    }
-   
+
    public void closing() throws JMSException
    {
       RequestSupport req = new ClosingRequest(id, version);
-      
+
       doInvoke(client, req);
    }
-   
+
    // ConsumerDelegate implementation --------------------------------------------------------------
-   
+
    public void cancelInflightMessages(long lastDeliveryId) throws JMSException
    {
       RequestSupport req = new ConsumerCancelInflightMessagesRequest(id, version, lastDeliveryId);
-      
+
       doInvoke(client, req);
    }
-   
+
    public void changeRate(float newRate) throws JMSException
    {
       RequestSupport req = new ConsumerChangeRateRequest(id, version, newRate);
-      
+
       doInvoke(client, req);
    }
 
@@ -151,7 +156,7 @@
    public Message receive(long timeout) 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
@@ -160,8 +165,8 @@
    public void setMessageListener(MessageListener listener)
    {
       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.
@@ -170,7 +175,7 @@
    {
       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.
@@ -179,7 +184,7 @@
    {
       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.
@@ -188,24 +193,24 @@
    {
       throw new IllegalStateException("This invocation should not be handled here!");
    }
-   
+
    // Streamable implementation ----------------------------------------------------------
 
    public void read(DataInputStream in) throws Exception
    {
       super.read(in);
-      
+
       bufferSize = in.readInt();
-      
+
       maxDeliveries = in.readInt();
    }
 
    public void write(DataOutputStream out) throws Exception
    {
       super.write(out);
-      
+
       out.writeInt(bufferSize);
-      
+
       out.writeInt(maxDeliveries);
    }
 
@@ -215,12 +220,12 @@
    {
       return "ConsumerDelegate[" + System.identityHashCode(this) + ", ID=" + id + "]";
    }
-   
+
    public int getBufferSize()
    {
       return bufferSize;
    }
-   
+
    public int getMaxDeliveries()
    {
       return maxDeliveries;

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java	2007-02-26 12:50:17 UTC (rev 2447)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java	2007-02-26 13:18:42 UTC (rev 2448)
@@ -65,6 +65,7 @@
 import org.jboss.jms.wireformat.SessionRecoverDeliveriesRequest;
 import org.jboss.jms.wireformat.SessionSendRequest;
 import org.jboss.jms.wireformat.SessionUnsubscribeRequest;
+import org.jboss.logging.Logger;
 
 /**
  * The client-side Session delegate class.
@@ -81,10 +82,12 @@
 {
    // Constants ------------------------------------------------------------------------------------
 
+   private static final Logger log = Logger.getLogger(ClientSessionDelegate.class);
+
    private static final long serialVersionUID = -8096852898620279131L;
-   
+
    // Attributes -----------------------------------------------------------------------------------
-   
+
    private int dupsOKBatchSize;
 
    // Static ---------------------------------------------------------------------------------------
@@ -94,7 +97,7 @@
    public ClientSessionDelegate(int objectID, int dupsOKBatchSize)
    {
       super(objectID);
-      
+
       this.dupsOKBatchSize = dupsOKBatchSize;
    }
 
@@ -106,6 +109,8 @@
 
    public void synchronizeWith(DelegateSupport nd) throws Exception
    {
+      log.debug(this + " synchronizing with " + nd);
+
       super.synchronizeWith(nd);
 
       ClientSessionDelegate newDelegate = (ClientSessionDelegate)nd;
@@ -115,7 +120,7 @@
       // synchronize (recursively) the client-side state
 
       state.synchronizeWith(newDelegate.getState());
-      
+
       client = ((ConnectionState)state.getParent()).getRemotingConnection().
          getRemotingClient();
    }
@@ -127,20 +132,20 @@
       client = ((ConnectionState)state.getParent()).getRemotingConnection().
                   getRemotingClient();
    }
-   
+
    // Closeable implementation ---------------------------------------------------------------------
-   
+
    public void close() throws JMSException
    {
       RequestSupport req = new CloseRequest(id, version);
-      
+
       doInvoke(client, req);
    }
-   
+
    public void closing() throws JMSException
    {
       RequestSupport req = new ClosingRequest(id, version);
-      
+
       doInvoke(client, req);
    }
 
@@ -198,10 +203,10 @@
       throws JMSException
    {
       RequestSupport req = new SessionCreateBrowserDelegateRequest(id, version, queue,
-                                                  messageSelector);
+                                                                   messageSelector);
 
       Object res = doInvoke(client, req);
-      
+
       return (BrowserDelegate)res;
    }
 
@@ -216,11 +221,11 @@
 
 
    public ConsumerDelegate createConsumerDelegate(JBossDestination destination, String selector,
-            boolean noLocal, String subscriptionName,
-            boolean connectionConsumer) throws JMSException
+                                                  boolean noLocal, String subscriptionName,
+                                                  boolean connectionConsumer) throws JMSException
    {
       RequestSupport req = new SessionCreateConsumerDelegateRequest(id, version, destination,
-               selector, noLocal, subscriptionName, connectionConsumer);
+                                                                    selector, noLocal, subscriptionName, connectionConsumer);
 
       return (ConsumerDelegate)doInvoke(client, req);
    }
@@ -461,20 +466,20 @@
 
       doInvoke(client, req);
    }
-   
+
    // Streamable overrides -------------------------------------------------------------------------
 
    public void read(DataInputStream in) throws Exception
    {
       super.read(in);
-      
+
       dupsOKBatchSize = in.readInt();
    }
 
    public void write(DataOutputStream out) throws Exception
    {
       super.write(out);
-      
+
       out.writeInt(dupsOKBatchSize);
    }
 
@@ -484,12 +489,12 @@
    {
       return dupsOKBatchSize;
    }
-   
+
    public String toString()
    {
       return "SessionDelegate[" + System.identityHashCode(this) + ", ID=" + id + "]";
    }
-   
+
    // Protected ------------------------------------------------------------------------------------
 
    // Package Private ------------------------------------------------------------------------------

Modified: trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java	2007-02-26 12:50:17 UTC (rev 2447)
+++ trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java	2007-02-26 13:18:42 UTC (rev 2448)
@@ -169,7 +169,7 @@
          
          if (oneWay)
          {
-            if (trace) { log.trace(this + " invoking " + req + " asynchronously on server"); }
+            if (trace) { log.trace(this + " invoking " + req + " asynchronously on server using " + client); }
 
             client.invokeOneway(req);
 
@@ -177,7 +177,7 @@
          }
          else
          {
-            if (trace) { log.trace(this + " invoking " + req + " synchronously on server"); }
+            if (trace) { log.trace(this + " invoking " + req + " synchronously on server using " + client); }
 
             resp = client.invoke(req);
 

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java	2007-02-26 12:50:17 UTC (rev 2447)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java	2007-02-26 13:18:42 UTC (rev 2448)
@@ -1787,6 +1787,47 @@
       }
    }
 
+   public void testCloseBrowser() throws Exception
+   {
+      Connection conn0 = null;
+      Connection conn1 = null;
+
+      try
+      {
+         conn0 = cf.createConnection();
+
+         // Objects Server1
+         conn1 = cf.createConnection();
+
+         assertEquals(1, ((JBossConnection)conn1).getServerID());
+
+         JMSRemotingConnection rc = ((ClientConnectionDelegate)((JBossConnection)conn1).
+            getDelegate()).getRemotingConnection();
+         rc.removeConnectionListener();
+
+         Session session1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         QueueBrowser browser = session1.createBrowser(queue[1]);
+
+         ServerManagement.killAndWait(1);
+
+         browser.close();
+      }
+      finally
+      {
+         if (conn1 != null)
+         {
+            conn1.close();
+         }
+
+         if (conn0 != null)
+         {
+            conn0.close();
+         }
+      }
+   }
+
+
    public void testCloseSession() throws Exception
    {
       Connection conn0 = null;




More information about the jboss-cvs-commits mailing list