This is an automated email from the ASF dual-hosted git repository.
gtully pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new 824eaf7 no jira - fix leak of connection in case of failed attempt to
connect
824eaf7 is described below
commit 824eaf7a692a8e2fd394e2a2e5f2da4d4b10d294
Author: gtully <[email protected]>
AuthorDate: Thu Sep 23 17:03:49 2021 +0100
no jira - fix leak of connection in case of failed attempt to connect
---
.../src/main/java/org/apache/activemq/artemis/util/ServerUtil.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git
a/artemis-cli/src/main/java/org/apache/activemq/artemis/util/ServerUtil.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/util/ServerUtil.java
index a953161..157ea52 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/util/ServerUtil.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/util/ServerUtil.java
@@ -135,8 +135,7 @@ public class ServerUtil {
public static boolean waitForServerToStart(String uri, String username,
String password, long timeout) throws InterruptedException {
long realTimeout = System.currentTimeMillis() + timeout;
while (System.currentTimeMillis() < realTimeout) {
- try (ActiveMQConnectionFactory cf =
ActiveMQJMSClient.createConnectionFactory(uri, null)) {
- cf.createConnection(username, password).close();
+ try (ActiveMQConnectionFactory cf =
ActiveMQJMSClient.createConnectionFactory(uri, null); Connection c =
cf.createConnection(username, password)) {
System.out.println("server " + uri + " started");
} catch (Exception e) {
System.out.println("awaiting server " + uri + " start at ");