You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2022/12/02 02:12:37 UTC

[james-project] branch master updated: [FIX] Leak in ActiveMQHealthCheck

This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git


The following commit(s) were added to refs/heads/master by this push:
     new 390be9e9e3 [FIX] Leak in ActiveMQHealthCheck
390be9e9e3 is described below

commit 390be9e9e3d048d2e177aa2fdf6b6732035a7c16
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Thu Dec 1 17:35:43 2022 +0700

    [FIX] Leak in ActiveMQHealthCheck
---
 .../java/org/apache/james/queue/activemq/ActiveMQHealthCheck.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQHealthCheck.java b/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQHealthCheck.java
index a60b92d11b..4a0a625231 100644
--- a/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQHealthCheck.java
+++ b/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQHealthCheck.java
@@ -54,8 +54,12 @@ public class ActiveMQHealthCheck implements HealthCheck {
         return Mono.fromCallable(() -> {
             try {
                 Connection connection = connectionFactory.createConnection();
-                Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
-                session.close();
+                try {
+                    Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
+                    session.close();
+                } finally {
+                    connection.close();
+                }
                 return Result.healthy(COMPONENT_NAME);
             } catch (Exception e) {
                 LOGGER.warn("{} is unhealthy. {}", COMPONENT_NAME.getName(), e.getMessage());


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org