You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2018/10/10 22:39:51 UTC

[1/2] activemq-artemis git commit: This closes #2363

Repository: activemq-artemis
Updated Branches:
  refs/heads/master a65374fe2 -> bcc3eb637


This closes #2363


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

Branch: refs/heads/master
Commit: bcc3eb6375c8803e2dce44ffcf021dd7c0a09b1d
Parents: a65374f 50f6bb5
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Oct 10 18:39:46 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Oct 10 18:39:46 2018 -0400

----------------------------------------------------------------------
 .../activemq/artemis/cli/commands/messages/Browse.java       | 4 ++++
 .../activemq/artemis/cli/commands/messages/Consumer.java     | 8 ++++++--
 .../activemq/artemis/cli/commands/messages/Producer.java     | 4 ++++
 3 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[2/2] activemq-artemis git commit: NO-JIRA close connection factory in CLI

Posted by cl...@apache.org.
NO-JIRA close connection factory in CLI

Fix warning seen in logs during test case runs, caused by CF not being closed.

Oct 10, 2018 8:53:18 PM org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl finalize
WARN: AMQ212008: I am closing a core ClientSessionFactory you left open. Please make sure you close all ClientSessionFactories explicitly before letting them go out of scope! 639,542,871
java.lang.Exception
	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.<init>(ClientSessionFactoryImpl.java:171)
	at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:779)
	at org.apache.activemq.artemis.cli.commands.messages.DestAbstract.getManagementSession(DestAbstract.java:103)
	at org.apache.activemq.artemis.cli.commands.messages.DestAbstract.getQueueAttribute(DestAbstract.java:127)
	at org.apache.activemq.artemis.cli.commands.messages.DestAbstract.getQueueIdFromName(DestAbstract.java:116)
	at org.apache.activemq.artemis.cli.commands.messages.Producer.execute(Producer.java:75)
	at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:150)
	at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:98)
	at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:125)
	at org.apache.activemq.artemis.cli.Artemis.main(Artemis.java:81)


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

Branch: refs/heads/master
Commit: 50f6bb5d07b5f609befc94fcde1808fdc0448e68
Parents: a65374f
Author: Michael André Pearce <mi...@me.com>
Authored: Wed Oct 10 22:11:21 2018 +0100
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Oct 10 18:39:46 2018 -0400

----------------------------------------------------------------------
 .../activemq/artemis/cli/commands/messages/Browse.java       | 4 ++++
 .../activemq/artemis/cli/commands/messages/Consumer.java     | 8 ++++++--
 .../activemq/artemis/cli/commands/messages/Producer.java     | 4 ++++
 3 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/50f6bb5d/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Browse.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Browse.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Browse.java
index e249cbf..7af3713 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Browse.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Browse.java
@@ -69,6 +69,10 @@ public class Browse extends DestAbstract {
          }
 
          return received;
+      } finally {
+         if (factory instanceof AutoCloseable) {
+            ((AutoCloseable) factory).close();
+         }
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/50f6bb5d/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Consumer.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Consumer.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Consumer.java
index 856e82b..c756e60 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Consumer.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Consumer.java
@@ -55,8 +55,6 @@ public class Consumer extends DestAbstract {
 
       System.out.println("Consumer:: filter = " + filter);
 
-      ConnectionFactory factory = createConnectionFactory();
-
       SerialiserMessageListener listener = null;
       MessageSerializer messageSerializer = null;
       if (file != null) {
@@ -83,6 +81,8 @@ public class Consumer extends DestAbstract {
 
       if (messageSerializer != null) messageSerializer.start();
 
+      ConnectionFactory factory = createConnectionFactory();
+
       try (Connection connection = factory.createConnection()) {
          // We read messages in a single thread when persisting to file.
          ConsumerThread[] threadsArray = new ConsumerThread[threads];
@@ -118,6 +118,10 @@ public class Consumer extends DestAbstract {
          if (messageSerializer != null) messageSerializer.stop();
 
          return received;
+      } finally {
+         if (factory instanceof AutoCloseable) {
+            ((AutoCloseable) factory).close();
+         }
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/50f6bb5d/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Producer.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Producer.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Producer.java
index 0936578..fc60e40 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Producer.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/Producer.java
@@ -137,6 +137,10 @@ public class Producer extends DestAbstract {
             }
             return messagesProduced;
          }
+      } finally {
+         if (factory instanceof AutoCloseable) {
+            ((AutoCloseable) factory).close();
+         }
       }
    }