[jboss-cvs] JBoss Messaging SVN: r1826 - trunk/src/main/org/jboss/jms/client/container

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Dec 19 12:32:33 EST 2006


Author: clebert.suconic at jboss.com
Date: 2006-12-19 12:32:32 -0500 (Tue, 19 Dec 2006)
New Revision: 1826

Modified:
   trunk/src/main/org/jboss/jms/client/container/HAAspect.java
Log:
removing valve from the stack

Modified: trunk/src/main/org/jboss/jms/client/container/HAAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/HAAspect.java	2006-12-19 17:19:47 UTC (rev 1825)
+++ trunk/src/main/org/jboss/jms/client/container/HAAspect.java	2006-12-19 17:32:32 UTC (rev 1826)
@@ -59,6 +59,8 @@
 import org.jboss.jms.server.endpoint.DeliveryRecovery;
 import org.jboss.jms.tx.ResourceManager;
 import org.jboss.logging.Logger;
+import org.jboss.remoting.ConnectionListener;
+import org.jboss.remoting.Client;
 
 /**
  *
@@ -162,8 +164,8 @@
 
       ClientConnectionDelegate cd = (ClientConnectionDelegate)res.getDelegate();
 
-      // ValveAspect is supposed to be created per ClientConnectionDelegate
-      //installValveAspect(cd, new ValveAspect(cd, this));
+      ((ConnectionState) ((DelegateSupport) cd).getState()).
+         getRemotingConnectionListener().addDelegateListener(new ConnectionFailureListener(cd));
 
       if(trace) { log.trace(this + " got local connection delegate " + cd); }
 
@@ -679,6 +681,45 @@
        }
     }
 
+
+
+
+   /** I have moved this ConnectionListener to ValveAspect (from HAAspect) because
+    *  it needs to use the same valve as exception listeners.
+    *  While we are processing failover, we should block any calls on the client side.
+    *  (No call should be made while the client failover is being executed). It doesn't matter if
+    *  the failover was captured by Lease (ConnectionFactory) or Exception handling on invoke at this class */
+   private class ConnectionFailureListener implements ConnectionListener
+   {
+      private ClientConnectionDelegate cd;
+
+      ConnectionFailureListener(ClientConnectionDelegate cd)
+      {
+         this.cd = cd;
+      }
+
+      // ConnectionListener implementation ---------------------------
+
+      public void handleConnectionException(Throwable throwable, Client client)
+      {
+         try
+         {
+            log.debug(this + " is being notified of connection failure: " + throwable);
+            handleConnectionFailure(cd);
+         }
+         catch (Throwable e)
+         {
+            log.error("Caught exception in handling failure", e);
+         }
+      }
+
+      public String toString()
+      {
+         return "ConnectionFailureListener[" + cd + "]";
+      }
+   }
+
+   
 }
 
 




More information about the jboss-cvs-commits mailing list