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

Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 6bba52eeb8c4 CAMEL-25144: fix(camel-milo): tcp connections may stay 
open on exception in (re)connect phase (#27084)
6bba52eeb8c4 is described below

commit 6bba52eeb8c4ea8eb12fec865c67eb83a462078e
Author: robMate <[email protected]>
AuthorDate: Wed Sep 30 18:46:52 2026 +0200

    CAMEL-25144: fix(camel-milo): tcp connections may stay open on exception in 
(re)connect phase (#27084)
    
    * fix milo conection exception handling
    
    make sure milo client is disconnected if connect throws exception 
(otherwise tcp connections may stay open)
    
    * Regen
    
    ---------
    
    Co-authored-by: Guillaume Nodet <[email protected]>
---
 .../camel/component/milo/client/internal/SubscriptionManager.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
 
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
index ed98afb4cbc5..e0063b00b0a1 100644
--- 
a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
+++ 
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/internal/SubscriptionManager.java
@@ -761,9 +761,11 @@ public class SubscriptionManager {
                     }
                 });
 
-        client.connect();
-
         try {
+
+            // connect is called inside this try block to ensure that 
disconnect is called on exceptions
+            client.connect();
+
             // Create subscription synchronously - the create() method blocks 
until complete
             OpcUaSubscription subscription = new OpcUaSubscription(client);
             subscription.setSubscriptionListener(new 
SubscriptionListenerImpl());

Reply via email to