undo previous commit as a quick way to solve a bunch of conflicts, will restore effect of changes after.
This reverts commit 477df644369ab515daf2d5a600dd245d35c05335. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/d376110e Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/d376110e Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/d376110e Branch: refs/heads/master Commit: d376110e3f9d86418640f1fe10ff266fd00be425 Parents: 477df64 Author: Robert Gemmell <rob...@apache.org> Authored: Tue Feb 24 15:36:10 2015 +0000 Committer: Robert Gemmell <rob...@apache.org> Committed: Tue Feb 24 15:36:10 2015 +0000 ---------------------------------------------------------------------- .../java/org/apache/qpid/jms/JmsConnection.java | 6 +--- .../jms/provider/amqp/AmqpAbstractResource.java | 35 ++++++++++---------- .../qpid/jms/provider/amqp/AmqpProvider.java | 7 ---- .../qpid/jms/provider/amqp/AmqpResource.java | 5 +-- .../integration/ConnectionIntegrationTest.java | 26 --------------- 5 files changed, 19 insertions(+), 60 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d376110e/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java index 32470ee..0b73cb4 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java @@ -1101,11 +1101,7 @@ public class JmsConnection implements Connection, TopicConnection, QueueConnecti @Override public void onResourceRemotelyClosed(JmsResource resource, Exception cause) { - if (resource.equals(this.connectionInfo)) { - onException(cause); - } else { - LOG.info("A JMS resource has been remotely closed: {}", resource); - } + LOG.info("A JMS resource has been remotely closed: {}", resource); } /** http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d376110e/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAbstractResource.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAbstractResource.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAbstractResource.java index 33b47cb..6612786 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAbstractResource.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAbstractResource.java @@ -22,7 +22,6 @@ import javax.jms.InvalidDestinationException; import javax.jms.JMSException; import javax.jms.JMSSecurityException; -import org.apache.qpid.jms.meta.JmsConnectionInfo; import org.apache.qpid.jms.meta.JmsResource; import org.apache.qpid.jms.provider.AsyncResult; import org.apache.qpid.proton.amqp.Symbol; @@ -163,25 +162,25 @@ public abstract class AmqpAbstractResource<R extends JmsResource, E extends Endp } @Override - public void remotelyClosed(AmqpProvider provider) { - Exception error = getRemoteError(); - if (error == null) { - error = new IOException("Remote has closed without error information"); - } - - if (endpoint != null) { - // TODO: if this is a producer/consumer link then we may only be detached, - // rather than fully closed, and should respond appropriately. - endpoint.close(); - } + public void remotelyClosed() { + if (isAwaitingOpen()) { + Exception error = getRemoteError(); + if (error == null) { + error = new IOException("Remote has closed without error information"); + } - LOG.info("Resource {} was remotely closed", getJmsResource()); + if (endpoint != null) { + // TODO: if this is a producer/consumer link then we may only be detached, + // rather than fully closed, and should respond appropriately. + endpoint.close(); + } - if (getJmsResource() instanceof JmsConnectionInfo) { - provider.fireProviderException(error); - } else { - provider.fireResourceRemotelyClosed(getJmsResource(), error); + openRequest.onFailure(error); + openRequest = null; } + + // TODO - We need a way to signal that the remote closed unexpectedly. + LOG.info("Resource was remotely closed"); } public E getEndpoint() { @@ -271,7 +270,7 @@ public abstract class AmqpAbstractResource<R extends JmsResource, E extends Endp failed(openError); } else { - remotelyClosed(provider); + remotelyClosed(); } } } http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d376110e/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java index 0face7b..3c4cae6 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpProvider.java @@ -802,13 +802,6 @@ public class AmqpProvider implements Provider, TransportListener { } } - void fireResourceRemotelyClosed(JmsResource resource, Exception ex) { - ProviderListener listener = this.listener; - if (listener != null) { - listener.onResourceRemotelyClosed(resource, ex); - } - } - private void checkClosed() throws ProviderClosedException { if (closed.get()) { throw new ProviderClosedException("This Provider is already closed"); http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d376110e/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpResource.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpResource.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpResource.java index 0a2a398..f577b21 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpResource.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpResource.java @@ -88,11 +88,8 @@ public interface AmqpResource { * Called to indicate that the remote end has become closed but the resource * was not awaiting a close. This could happen during an open request where * the remote does not set an error condition or during normal operation. - * - * @param provider - * a reference to the AMQP provider to use to send the remote close event. */ - void remotelyClosed(AmqpProvider provider); + void remotelyClosed(); /** * Sets the failed state for this Resource and triggers a failure signal for http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d376110e/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java index ad1a6f6..c6b8632 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionIntegrationTest.java @@ -25,14 +25,9 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - import javax.jms.Connection; import javax.jms.ConnectionMetaData; -import javax.jms.ExceptionListener; import javax.jms.IllegalStateException; -import javax.jms.JMSException; import javax.jms.MessageConsumer; import javax.jms.Queue; import javax.jms.Session; @@ -94,27 +89,6 @@ public class ConnectionIntegrationTest extends QpidJmsTestCase { } } - @Test(timeout = 10000) - public void testRemotelyEndConnectionListenerInvoked() throws Exception { - try (TestAmqpPeer testPeer = new TestAmqpPeer();) { - final CountDownLatch done = new CountDownLatch(1); - - Connection connection = testFixture.establishConnecton(testPeer); - connection.setExceptionListener(new ExceptionListener() { - - @Override - public void onException(JMSException exception) { - done.countDown(); - } - }); - - testPeer.remotelyEndConnection(true); - testPeer.waitForAllHandlersToComplete(1000); - - assertTrue("Connection should report failure", done.await(5, TimeUnit.SECONDS)); - } - } - @Ignore // TODO: resolve related issues and enable @Test(timeout = 5000) public void testRemotelyEndConnectionWithSessionWithConsumer() throws Exception { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org