You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2015/03/06 19:38:24 UTC

qpid-jms git commit: add workaround for sending erroneous frames, required until upgrading to Proton 0.9

Repository: qpid-jms
Updated Branches:
  refs/heads/master 0f0afdd5a -> fe0c416d3


add workaround for sending erroneous frames, required until upgrading to Proton 0.9


Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/fe0c416d
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/fe0c416d
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/fe0c416d

Branch: refs/heads/master
Commit: fe0c416d3dc93fd74cfb1fc65bea7ce19a37aeeb
Parents: 0f0afdd
Author: Robert Gemmell <ro...@apache.org>
Authored: Fri Mar 6 18:38:08 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Fri Mar 6 18:38:08 2015 +0000

----------------------------------------------------------------------
 .../jms/provider/amqp/AmqpAbstractResource.java | 22 +++++++++++++++++---
 .../jms/integration/SessionIntegrationTest.java |  2 --
 2 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/fe0c416d/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 9bd3740..9208a42 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
@@ -30,6 +30,7 @@ import org.apache.qpid.proton.amqp.transport.AmqpError;
 import org.apache.qpid.proton.amqp.transport.ErrorCondition;
 import org.apache.qpid.proton.engine.Endpoint;
 import org.apache.qpid.proton.engine.EndpointState;
+import org.apache.qpid.proton.engine.Link;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -130,8 +131,17 @@ public abstract class AmqpAbstractResource<R extends JmsResource, E extends Endp
 
     @Override
     public void closed() {
-        getEndpoint().close();
-        getEndpoint().free();
+        if (endpoint instanceof Link) {
+            // TODO: Workaround for PROTON-833. Remove when upgrading to 0.9
+            Link l = ((Link) endpoint);
+            if (l.getSession().getLocalState() != EndpointState.CLOSED) {
+                endpoint.close();
+                endpoint.free();
+            }
+        } else {
+            endpoint.close();
+            endpoint.free();
+        }
 
         if (this.closeRequest != null) {
             this.closeRequest.onSuccess();
@@ -169,7 +179,13 @@ public abstract class AmqpAbstractResource<R extends JmsResource, E extends Endp
             error = new IOException("Remote has closed without error information");
         }
 
-        if (endpoint != null) {
+        if (endpoint instanceof Link) {
+            // TODO: Workaround for PROTON-833. Remove when upgrading to 0.9
+            Link l = ((Link) endpoint);
+            if (l.getSession().getLocalState() != EndpointState.CLOSED) {
+                endpoint.close();
+            }
+        } else 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();

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/fe0c416d/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
index 23ad835..0c26d10 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
@@ -1251,7 +1251,6 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
         }
     }
 
-    @Ignore // TODO: fails due to PROTON-833. Needs workaround or 0.9 to resolve.
     @Test(timeout = 5000)
     public void testCloseSessionWithConsumerThatRemoteDetaches() throws Exception {
         try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
@@ -1278,7 +1277,6 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
         }
     }
 
-    @Ignore // TODO: fails due to PROTON-833. Needs workaround or 0.9 to resolve.
     @Test(timeout = 5000)
     public void testCloseSessionWithConsumerThatRemoteDetachesWithUnackedMessages() throws Exception {
         try (TestAmqpPeer testPeer = new TestAmqpPeer();) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org