From 82ea10d9f165e405f329e33cf10d2df8b3e7f897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Galder=20Zamarren=CC=83o?= Date: Thu, 1 Mar 2018 18:28:49 +0100 Subject: [PATCH] ISPN-8900 Make sure sockets are closed if can't connect --- .../client/hotrod/impl/transport/tcp/TcpTransport.java | 1 + 1 file changed, 1 insertion(+) diff --git a/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TcpTransport.java b/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TcpTransport.java index dd196e1c42f1..968970c5dfdd 100644 --- a/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TcpTransport.java +++ b/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/tcp/TcpTransport.java @@ -91,6 +91,7 @@ public TcpTransport(SocketAddress originalServerAddress, TransportFactory transp } catch (Exception e) { String message = String.format("Could not connect to server: %s", serverAddress); log.tracef(e, "Could not connect to server: %s", serverAddress); + destroy(); // Destroy just to avoid leaking open sockets throw new TransportException(message, e, serverAddress); } }