Author: ritchiem Date: Fri Apr 17 13:48:01 2009 New Revision: 766005 URL: http://svn.apache.org/viewvc?rev=766005&view=rev Log: QPID-1779 : Update to ensure CACFTest reports failures correctly and resolved the issue that it was not showing.
merged from trunk r764790 Modified: qpid/branches/0.5-release/qpid/java/ (props changed) qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java qpid/branches/0.5-release/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java (props changed) qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/CloseAfterConnectionFailureTest.java Propchange: qpid/branches/0.5-release/qpid/java/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Fri Apr 17 13:48:01 2009 @@ -1 +1 @@ -/qpid/trunk/qpid/java:764838 +/qpid/trunk/qpid/java:764790,764838 Modified: qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java URL: http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java?rev=766005&r1=766004&r2=766005&view=diff ============================================================================== --- qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java (original) +++ qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java Fri Apr 17 13:48:01 2009 @@ -1326,6 +1326,8 @@ // handling sequence if (cause instanceof IOException || cause instanceof AMQDisconnectedException) { + // If we have an IOE/AMQDisconnect there is no connection to close on. + _closing.set(false); closer = !_closed.getAndSet(true); _protocolHandler.getProtocolSession().notifyError(je); Modified: qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java URL: http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java?rev=766005&r1=766004&r2=766005&view=diff ============================================================================== --- qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java (original) +++ qpid/branches/0.5-release/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java Fri Apr 17 13:48:01 2009 @@ -21,6 +21,7 @@ package org.apache.qpid.client; import java.io.Serializable; +import java.io.IOException; import java.net.URISyntaxException; import java.text.MessageFormat; import java.util.ArrayList; @@ -698,7 +699,11 @@ // Failover failed and ain't coming back. Knife the dispatcher. _dispatcherThread.interrupt(); } - } + + } + + //if we don't have an exception then we can perform closing operations + _closing.set(e == null); if (!_closed.getAndSet(true)) { @@ -3000,4 +3005,27 @@ } } } + + /** + * Checks if the Session and its parent connection are closed + * + * @return <tt>true</tt> if this is closed, <tt>false</tt> otherwise. + */ + @Override + public boolean isClosed() + { + return _closed.get() || _connection.isClosed(); + } + + /** + * Checks if the Session and its parent connection are capable of performing + * closing operations + * + * @return <tt>true</tt> if we are closing, <tt>false</tt> otherwise. + */ + @Override + public boolean isClosing() + { + return _closing.get()|| _connection.isClosing(); + } } Propchange: qpid/branches/0.5-release/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Fri Apr 17 13:48:01 2009 @@ -1 +1 @@ -/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java:762365,764838 +/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java:762365,764790,764838 Modified: qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/CloseAfterConnectionFailureTest.java URL: http://svn.apache.org/viewvc/qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/CloseAfterConnectionFailureTest.java?rev=766005&r1=766004&r2=766005&view=diff ============================================================================== --- qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/CloseAfterConnectionFailureTest.java (original) +++ qpid/branches/0.5-release/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/CloseAfterConnectionFailureTest.java Fri Apr 17 13:48:01 2009 @@ -42,6 +42,7 @@ Session session; MessageConsumer consumer; private CountDownLatch _latch = new CountDownLatch(1); + private JMSException _fail; public void testNoFailover() throws URLSyntaxException, AMQVMBrokerCreationException, InterruptedException, JMSException @@ -63,6 +64,12 @@ //Kill connection TransportConnection.killAllVMBrokers(); _latch.await(); + + if (_fail != null) + { + _fail.printStackTrace(System.out); + fail("Exception thrown:" + _fail.getMessage()); + } } catch (AMQException e) { @@ -72,39 +79,43 @@ public void onException(JMSException e) { - System.err.println("Connection isClosed after connection Falure?:" + connection.isClosed()); + System.out.println("Connection isClosed after connection Falure?:" + connection.isClosed()); try { consumer.close(); } - catch (JMSException jsme) + catch (JMSException jmse) { - System.err.println("Consumer close failed with:" + jsme.getMessage()); + System.out.println("Consumer close failed with:" + jmse.getMessage()); + _fail = jmse; } - System.err.println("Connection isClosed after connection Falure?:" + connection.isClosed()); + System.out.println("Connection isClosed after connection Falure?:" + connection.isClosed()); try { //Note that if we actually do session.close() we will lock up as the session will never receive a frame // from the - ((AMQSession)session).close(10); + ((AMQSession) session).close(10); } - catch (JMSException jsme) + catch (JMSException jmse) { - System.err.println("Session close failed with:" + jsme.getMessage()); + System.out.println("Session close failed with:" + jmse.getMessage()); + _fail = jmse; } - System.err.println("Connection isClosed after connection Falure?:" + connection.isClosed()); + System.out.println("Connection isClosed after connection Falure?:" + connection.isClosed()); try { connection.close(); } - catch (JMSException jsme) + catch (JMSException jmse) { - System.err.println("Session close failed with:" + jsme.getMessage()); + System.out.println("Session close failed with:" + jmse.getMessage()); + _fail = jmse; } - System.err.println("Connection isClosed after connection Falure?:" + connection.isClosed()); + System.out.println("Connection isClosed after connection Falure?:" + connection.isClosed()); _latch.countDown(); + } } --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org