From do-not-reply at jboss.org Tue Mar 15 07:38:31 2011 Content-Type: multipart/mixed; boundary="===============6038579240210102392==" MIME-Version: 1.0 From: do-not-reply at jboss.org To: hornetq-commits at lists.jboss.org Subject: [hornetq-commits] JBoss hornetq SVN: r10338 - in branches/Branch_2_2_EAP: src/main/org/hornetq/jms/client and 3 other directories. Date: Tue, 15 Mar 2011 07:38:31 -0400 Message-ID: <201103151138.p2FBcVsg010827@svn01.web.mwc.hst.phx2.redhat.com> --===============6038579240210102392== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ataylor Date: 2011-03-15 07:38:30 -0400 (Tue, 15 Mar 2011) New Revision: 10338 Modified: branches/Branch_2_2_EAP/docs/user-manual/en/ha.xml branches/Branch_2_2_EAP/src/main/org/hornetq/jms/client/HornetQConnectio= n.java branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQRAManagedConnecti= on.java branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/= failover/FailoverTestBase.java branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/clus= ter/JMSReconnectTest.java Log: https://issues.jboss.org/browse/HORNETQ-653 Modified: branches/Branch_2_2_EAP/docs/user-manual/en/ha.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/Branch_2_2_EAP/docs/user-manual/en/ha.xml 2011-03-15 11:18:33 = UTC (rev 10337) +++ branches/Branch_2_2_EAP/docs/user-manual/en/ha.xml 2011-03-15 11:38:30 = UTC (rev 10338) @@ -302,7 +302,37 @@ Any ExceptionListener or SessionFailureListener instance= will always be called by HornetQ on event of connection failure, irrespective of whether the connection was= successfully failed over, - reconnected or reattached. + reconnected or reattached, however you can find out if rec= onnect or reattach has happened + by either the failedOver flag passed in on = the connectionFailed + on SessionfailureListener or by inspecti= ng the error code on the + javax.jms.JMSException which will be one= of the following: + + JMSException error codes + + + + + + error code + Description + + + + + FAILOVER + + Failover has occurred and we have successfully r= eattached or reconnected. + + + + DISCONNECT + + No failover has occurred and we are disconnected. + + + + +
Application-Level Failover Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/client/HornetQCo= nnection.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/client/HornetQConnecti= on.java 2011-03-15 11:18:33 UTC (rev 10337) +++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/client/HornetQConnecti= on.java 2011-03-15 11:38:30 UTC (rev 10338) @@ -69,6 +69,10 @@ = public static final int TYPE_TOPIC_CONNECTION =3D 2; = + public static final String EXCEPTION_FAILOVER =3D "FAILOVER"; + + public static final String EXCEPTION_DISCONNECT =3D "DISCONNECT"; + public static final SimpleString CONNECTION_ID_PROPERTY_NAME =3D new Si= mpleString("__HQ_CID"); = // Static -------------------------------------------------------------= -------------------------- @@ -628,7 +632,7 @@ = HornetQConnection conn =3D connectionRef.get(); = - if (conn !=3D null && ! failedOver) + if (conn !=3D null) { try { @@ -636,7 +640,7 @@ = if (exceptionListener !=3D null) { - final JMSException je =3D new JMSException(me.toString()= ); + final JMSException je =3D new JMSException(me.toString()= , failedOver?EXCEPTION_FAILOVER: EXCEPTION_DISCONNECT); = je.initCause(me); = Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQRAManagedC= onnection.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQRAManagedConnect= ion.java 2011-03-15 11:18:33 UTC (rev 10337) +++ branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQRAManagedConnect= ion.java 2011-03-15 11:38:30 UTC (rev 10338) @@ -51,6 +51,7 @@ import javax.transaction.xa.XAResource; = import org.hornetq.core.logging.Logger; +import org.hornetq.jms.client.HornetQConnection; = /** * The managed connection @@ -555,6 +556,10 @@ */ public void onException(final JMSException exception) { + if(HornetQConnection.EXCEPTION_FAILOVER.equals(exception.getErrorCod= e())) + { + return; + } if (HornetQRAManagedConnection.trace) { HornetQRAManagedConnection.log.trace("onException(" + exception += ")"); Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/c= luster/failover/FailoverTestBase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster= /failover/FailoverTestBase.java 2011-03-15 11:18:33 UTC (rev 10337) +++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster= /failover/FailoverTestBase.java 2011-03-15 11:38:30 UTC (rev 10338) @@ -262,6 +262,7 @@ fail("backup server never started"); } } + System.out.println("sf.getBackupConnector() =3D " + sf.getBackupConn= ector()); } = protected void waitForBackup(long seconds) Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/j= ms/cluster/JMSReconnectTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/clu= ster/JMSReconnectTest.java 2011-03-15 11:18:33 UTC (rev 10337) +++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/clu= ster/JMSReconnectTest.java 2011-03-15 11:38:30 UTC (rev 10338) @@ -169,10 +169,10 @@ conn.close(); = = -// TODO - https://issues.jboss.org/browse/HORNETQ-653 -// Assert.assertNotNull(listener.e); -// -// Assert.assertTrue(me =3D=3D listener.e.getCause()); + + Assert.assertNotNull(listener.e); + + Assert.assertTrue(me =3D=3D listener.e.getCause()); } = public void testReconnectSameNodeServerRestartedWithNonDurableSub() thr= ows Exception @@ -257,8 +257,7 @@ = conn.close(); = - // TODO - https://issues.jboss.org/browse/HORNETQ-653 - //Assert.assertNotNull(listener.e); + Assert.assertNotNull(listener.e); } = //If the server is shutdown after a non durable sub is created, then cl= ose on the connection should proceed normally --===============6038579240210102392==--