activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/4] activemq-artemis git commit: ARTEMIS-756 disabling finalize check over CDI Connection Factories
Date Mon, 24 Oct 2016 15:00:44 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 0f69bbdf0 -> af676d208


ARTEMIS-756 disabling finalize check over CDI Connection Factories


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/e71f3d8a
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/e71f3d8a
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/e71f3d8a

Branch: refs/heads/master
Commit: e71f3d8a34c39f5d166e107d733b66841dba605a
Parents: 2ee742b
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Mon Oct 24 10:37:22 2016 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Mon Oct 24 10:37:27 2016 -0400

----------------------------------------------------------------------
 .../activemq/artemis/jms/client/ActiveMQConnection.java |  4 +++-
 .../artemis/jms/client/ActiveMQConnectionFactory.java   | 12 ++++++++++++
 .../client/cdi/factory/ConnectionFactoryProvider.java   |  3 ++-
 3 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e71f3d8a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
index 440b576..0c6cf9d 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
@@ -572,7 +572,9 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl
impleme
    @Override
    protected final void finalize() throws Throwable {
       if (!closed) {
-         ActiveMQJMSClientLogger.LOGGER.connectionLeftOpen(creationStack);
+         if (this.factoryReference.isFinalizeChecks()) {
+            ActiveMQJMSClientLogger.LOGGER.connectionLeftOpen(creationStack);
+         }
 
          close();
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e71f3d8a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
index 4f6528b..91dee3c 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
@@ -83,6 +83,8 @@ public class ActiveMQConnectionFactory implements ConnectionFactoryOptions,
Exte
 
    private String deserializationWhiteList;
 
+   private boolean finalizeChecks;
+
    @Override
    public void writeExternal(ObjectOutput out) throws IOException {
       URI uri = toURI();
@@ -148,6 +150,16 @@ public class ActiveMQConnectionFactory implements ConnectionFactoryOptions,
Exte
       }
    }
 
+   public ActiveMQConnectionFactory disableFinalizeChecks() {
+      this.finalizeChecks = false;
+      return this;
+   }
+
+   public boolean isFinalizeChecks() {
+      return finalizeChecks;
+   }
+
+
    @Override
    public String getDeserializationBlackList() {
       return deserializationBlackList;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e71f3d8a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/factory/ConnectionFactoryProvider.java
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/factory/ConnectionFactoryProvider.java
b/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/factory/ConnectionFactoryProvider.java
index b57b771..b249474 100644
--- a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/factory/ConnectionFactoryProvider.java
+++ b/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/factory/ConnectionFactoryProvider.java
@@ -97,6 +97,7 @@ public class ConnectionFactoryProvider {
          activeMQConnectionFactory.setUser(configuration.getUsername());
          activeMQConnectionFactory.setPassword(configuration.getPassword());
       }
-      return activeMQConnectionFactory;
+      // The CF will probably be GCed since it was injected, so we disable the finalize check
+      return activeMQConnectionFactory.disableFinalizeChecks();
    }
 }


Mime
View raw message