qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject [6/7] qpid-jms git commit: verify a non-null terminus during producer open completion, fail if otherwise
Date Mon, 10 Nov 2014 17:54:16 GMT
verify a non-null terminus during producer open completion, fail if otherwise


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

Branch: refs/heads/master
Commit: c1c8b5b5c371b2ee6f556a79657113be6a28416c
Parents: 85a310a
Author: Robert Gemmell <robbie@apache.org>
Authored: Mon Nov 10 16:31:53 2014 +0000
Committer: Robert Gemmell <robbie@apache.org>
Committed: Mon Nov 10 17:48:37 2014 +0000

----------------------------------------------------------------------
 .../qpid/jms/provider/amqp/AmqpAbstractResource.java  | 14 +++++++++++---
 .../qpid/jms/provider/amqp/AmqpFixedProducer.java     | 12 ++++++++++++
 2 files changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/c1c8b5b5/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 933683a..7da5e02 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
@@ -228,10 +228,8 @@ public abstract class AmqpAbstractResource<R extends JmsResource,
E extends Endp
 
         if (remoteState == EndpointState.ACTIVE) {
             if (isAwaitingOpen()) {
-                LOG.debug("{} is now open: ", this);
-                opened();
+                doOpenCompletion();
             }
-
             // Should not receive an ACTIVE event if not awaiting the open state.
         } else if (remoteState == EndpointState.CLOSED) {
             if (isAwaitingClose()) {
@@ -266,6 +264,16 @@ public abstract class AmqpAbstractResource<R extends JmsResource,
E extends Endp
     }
 
     /**
+     * Complete the open operation on the managed endpoint. A subclass may
+     * override this method to provide additional verification actions or configuration
+     * updates.
+     */
+    protected void doOpenCompletion() {
+        LOG.debug("{} is now open: ", this);
+        opened();
+    }
+
+    /**
      * Perform the close operation on the managed endpoint.  A subclass may
      * override this method to provide additional close actions or alter the
      * standard close path such as endpoint detach etc.

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/c1c8b5b5/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java
index 8cc5a74..60df921 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpFixedProducer.java
@@ -264,6 +264,18 @@ public class AmqpFixedProducer extends AmqpProducer {
         super.doOpen();
     }
 
+    @Override
+    protected void doOpenCompletion() {
+        // Verify the attach response contained a non-null target
+        org.apache.qpid.proton.amqp.transport.Target t = getEndpoint().getRemoteTarget();
+        if (t == null) {
+            // No link terminus was created, the peer should now detach us. Producer creation
has failed.
+            failed(new RuntimeException("link was refused")); //TODO: proper exception.
+        } else {
+            super.doOpenCompletion();
+        }
+    }
+
     public AmqpSession getSession() {
         return this.session;
     }


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


Mime
View raw message