diff --git a/java/src/main/java/com/genexus/internet/HttpClientJavaLib.java b/java/src/main/java/com/genexus/internet/HttpClientJavaLib.java index 875cbb51f..608ed9285 100644 --- a/java/src/main/java/com/genexus/internet/HttpClientJavaLib.java +++ b/java/src/main/java/com/genexus/internet/HttpClientJavaLib.java @@ -13,8 +13,6 @@ import java.security.cert.CertificateException; import java.util.*; import java.net.URI; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import javax.net.ssl.SSLContext; import org.apache.http.*; @@ -95,7 +93,6 @@ private static void getPoolInstance() { @Override protected void finalize() { this.closeOpenedStreams(); - executor.shutdown(); } private ConnectionKeepAliveStrategy generateKeepAliveStrategy() { @@ -617,9 +614,7 @@ public void execute(String method, String url) { } finally { if (Application.isJMXEnabled()){ - if (executor.isShutdown()) - executor = Executors.newSingleThreadExecutor(); - executor.submit(this::displayHTTPConnections); + this.displayHTTPConnections(); } if (getIsURL()) { this.setHost(getPrevURLhost()); @@ -631,8 +626,7 @@ public void execute(String method, String url) { resetStateAdapted(); } } - - private static ExecutorService executor = Executors.newSingleThreadExecutor(); + private synchronized void displayHTTPConnections(){ Iterator iterator = storedRoutes.iterator(); while (iterator.hasNext()) {