qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject qpid-jms git commit: QPIDJMS-109 Ensure that closed resources are unreferenced by the Proton bits and clear out held references at end of TX to prevent leaking memory.
Date Mon, 28 Sep 2015 17:51:35 GMT
Repository: qpid-jms
Updated Branches:
  refs/heads/master 2ccb2fb06 -> a15aa6902


QPIDJMS-109 Ensure that closed resources are unreferenced by the Proton
bits and clear out held references at end of TX to prevent leaking
memory. 

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

Branch: refs/heads/master
Commit: a15aa690275ee443ab461b53ea2f9fc01e1d1a57
Parents: 2ccb2fb
Author: Timothy Bish <tabish121@gmail.com>
Authored: Mon Sep 28 13:51:22 2015 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Mon Sep 28 13:51:22 2015 -0400

----------------------------------------------------------------------
 .../jms/provider/amqp/AmqpAbstractResource.java     | 16 +++++++++-------
 .../apache/qpid/jms/provider/amqp/AmqpConsumer.java |  2 +-
 .../jms/provider/amqp/AmqpTransactionContext.java   |  4 ++++
 3 files changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a15aa690/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 220e362..91d220a 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
@@ -83,8 +83,9 @@ public abstract class AmqpAbstractResource<R extends JmsResource, E extends
Endp
 
             // Remote already closed this resource, close locally and free.
             if (getEndpoint().getLocalState() != EndpointState.CLOSED) {
-                doClose();
+                getEndpoint().close();
                 getEndpoint().free();
+                getEndpoint().setContext(null);
             }
 
             request.onSuccess();
@@ -93,12 +94,13 @@ public abstract class AmqpAbstractResource<R extends JmsResource, E
extends Endp
 
         closeRequest = request;
 
-        doClose();
+        closeOrDetachEndpoint();
     }
 
     public void resourceClosed() {
-        endpoint.close();
-        endpoint.free();
+        getEndpoint().close();
+        getEndpoint().free();
+        getEndpoint().setContext(null);
 
         if (this.closeRequest != null) {
             this.closeRequest.onSuccess();
@@ -130,10 +132,10 @@ public abstract class AmqpAbstractResource<R extends JmsResource,
E extends Endp
 
     /**
      * 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.
+     * override this method to alter the standard close path such as endpoint
+     * detach etc.
      */
-    protected void doClose() {
+    protected void closeOrDetachEndpoint() {
         getEndpoint().close();
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a15aa690/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConsumer.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConsumer.java
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConsumer.java
index 4c12511..9b28cd8 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConsumer.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConsumer.java
@@ -429,7 +429,7 @@ public class AmqpConsumer extends AmqpAbstractResource<JmsConsumerInfo,
Receiver
     }
 
     @Override
-    protected void doClose() {
+    protected void closeOrDetachEndpoint() {
         if (getResourceInfo().isDurable()) {
             getEndpoint().detach();
         } else {

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a15aa690/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransactionContext.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransactionContext.java
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransactionContext.java
index f36a22e..222279f 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransactionContext.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTransactionContext.java
@@ -225,12 +225,16 @@ public class AmqpTransactionContext extends AmqpAbstractResource<JmsSessionInfo,
         for (AmqpConsumer consumer : txConsumers) {
             consumer.postCommit();
         }
+
+        txConsumers.clear();
     }
 
     private void postRollback() throws Exception {
         for (AmqpConsumer consumer : txConsumers) {
             consumer.postRollback();
         }
+
+        txConsumers.clear();
     }
 
     private void sendTxCommand(Message message) throws IOException {


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


Mime
View raw message