qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject [2/3] git commit: Create a specialized session object used soley by the connection to provide a place for things like durable unsubscribe, etc.
Date Thu, 16 Oct 2014 22:55:30 GMT
Create a specialized session object used soley by the connection to
provide a place for things like durable unsubscribe, etc. 

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

Branch: refs/heads/master
Commit: 1ec8e2ca8521819b982b1ba853859a12b32014a5
Parents: 49db0e5
Author: Timothy Bish <tabish121@gmail.com>
Authored: Thu Oct 16 16:51:25 2014 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Thu Oct 16 16:51:25 2014 -0400

----------------------------------------------------------------------
 .../qpid/jms/provider/amqp/AmqpConnection.java  |  8 ++-
 .../provider/amqp/AmqpConnectionSession.java    | 51 ++++++++++++++++++++
 .../qpid/jms/provider/amqp/AmqpProvider.java    |  2 +-
 3 files changed, 58 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/1ec8e2ca/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConnection.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConnection.java
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConnection.java
index 97118d7..f3d09b0 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConnection.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConnection.java
@@ -48,7 +48,7 @@ public class AmqpConnection extends AbstractAmqpResource<JmsConnectionInfo,
Conn
     private final AmqpProvider provider;
     private boolean connected;
     private AmqpSaslAuthenticator authenticator;
-    private final AmqpSession connectionSession;
+    private final AmqpConnectionSession connectionSession;
     private AmqpConnectionProperties properties;
 
     private String queuePrefix;
@@ -83,7 +83,7 @@ public class AmqpConnection extends AbstractAmqpResource<JmsConnectionInfo,
Conn
         JmsSessionInfo sessionInfo = new JmsSessionInfo(this.info, -1);
         sessionInfo.setAcknowledgementMode(Session.AUTO_ACKNOWLEDGE);
 
-        this.connectionSession = new AmqpSession(this, sessionInfo);
+        this.connectionSession = new AmqpConnectionSession(this, sessionInfo);
     }
 
     @Override
@@ -106,6 +106,10 @@ public class AmqpConnection extends AbstractAmqpResource<JmsConnectionInfo,
Conn
         return temporary;
     }
 
+    public void unsubscribe(String subscriptionName, AsyncResult request) {
+        connectionSession.unsubscribe(subscriptionName, request);
+    }
+
     /**
      * Called on receiving an event from Proton indicating a state change on the remote
      * side of the Connection.

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/1ec8e2ca/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConnectionSession.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConnectionSession.java
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConnectionSession.java
new file mode 100644
index 0000000..341893e
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConnectionSession.java
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.provider.amqp;
+
+import org.apache.qpid.jms.meta.JmsSessionInfo;
+import org.apache.qpid.jms.provider.AsyncResult;
+
+/**
+ * Subclass of the standard session object used solely by AmqpConnection to
+ * aid in managing connection resources that require a persistent session.
+ */
+public class AmqpConnectionSession extends AmqpSession {
+
+    /**
+     * Create a new instance of a Connection owned Session object.
+     *
+     * @param connection
+     *        the connection that owns this session.
+     * @param info
+     *        the <code>JmsSessionInfo</code> for the Session to create.
+     */
+    public AmqpConnectionSession(AmqpConnection connection, JmsSessionInfo info) {
+        super(connection, info);
+    }
+
+    /**
+     * Used to remove an existing durable topic subscription from the remote broker.
+     *
+     * @param subscriptionName
+     *        the subscription name that is to be removed.
+     * @param request
+     *        the request that awaits the completion of this action.
+     */
+    public void unsubscribe(String subscriptionName, AsyncResult request) {
+        request.onSuccess();
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/1ec8e2ca/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 3928b03..e5b5f7a 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
@@ -524,8 +524,8 @@ public class AmqpProvider extends AbstractProvider implements TransportListener
             public void run() {
                 try {
                     checkClosed();
+                    connection.unsubscribe(subscription, request);
                     pumpToProtonTransport();
-                    request.onSuccess();
                 } catch (Exception error) {
                     request.onFailure(error);
                 }


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


Mime
View raw message