|
192 | 192 | import jakarta.ws.rs.client.Client; |
193 | 193 | import jakarta.ws.rs.client.ClientBuilder; |
194 | 194 | import jakarta.ws.rs.client.ClientRequestFilter; |
195 | | -import java.util.concurrent.ScheduledExecutorService; |
196 | 195 | import javax.xml.transform.TransformerException; |
197 | 196 | import javax.xml.transform.stream.StreamSource; |
198 | 197 | import net.jodah.expiringmap.ExpiringMap; |
@@ -1387,22 +1386,6 @@ public void releaseConnection(final HttpClientConnection managedConn, final Obje |
1387 | 1386 | if (maxTotalConn != null) conman.setMaxTotal(maxTotalConn); |
1388 | 1387 | conman.setValidateAfterInactivity(30000); // check connections idle for more than Varnish's idle_timeout which is 5s |
1389 | 1388 |
|
1390 | | - Integer idleConnTimeout = 4000; |
1391 | | - // create monitor thread that evicts idle connections: https://hc.apache.org/httpcomponents-client-4.5.x/current/tutorial/html/connmgmt.html#d5e418 |
1392 | | - ScheduledExecutorService idleConnectionMonitor = Executors.newSingleThreadScheduledExecutor(); |
1393 | | - idleConnectionMonitor.scheduleAtFixedRate(() -> |
1394 | | - { |
1395 | | - try |
1396 | | - { |
1397 | | - if (log.isDebugEnabled()) log.debug("Evicting idle HTTP connections (every {} ms)", idleConnTimeout); |
1398 | | - conman.closeIdleConnections(idleConnTimeout, TimeUnit.MILLISECONDS); |
1399 | | - } |
1400 | | - catch (Exception ex) |
1401 | | - { |
1402 | | - if (log.isErrorEnabled()) log.error("Error closing idle connections: {}", ex); |
1403 | | - } |
1404 | | - }, 0, idleConnTimeout, java.util.concurrent.TimeUnit.MILLISECONDS); |
1405 | | - |
1406 | 1389 | ClientConfig config = new ClientConfig(); |
1407 | 1390 | config.connectorProvider(new ApacheConnectorProvider()); |
1408 | 1391 | config.register(MultiPartFeature.class); |
@@ -1483,22 +1466,6 @@ public void releaseConnection(final HttpClientConnection managedConn, final Obje |
1483 | 1466 | if (maxConnPerRoute != null) conman.setDefaultMaxPerRoute(maxConnPerRoute); |
1484 | 1467 | if (maxTotalConn != null) conman.setMaxTotal(maxTotalConn); |
1485 | 1468 | conman.setValidateAfterInactivity(30000); // check connections idle for more than Varnish's idle_timeout which is 5s |
1486 | | - |
1487 | | - Integer idleConnTimeout = 4000; |
1488 | | - // create monitor thread that evicts idle connections: https://hc.apache.org/httpcomponents-client-4.5.x/current/tutorial/html/connmgmt.html#d5e418 |
1489 | | - ScheduledExecutorService idleConnectionMonitor = Executors.newSingleThreadScheduledExecutor(); |
1490 | | - idleConnectionMonitor.scheduleAtFixedRate(() -> |
1491 | | - { |
1492 | | - try |
1493 | | - { |
1494 | | - if (log.isDebugEnabled()) log.debug("Evicting idle HTTP connections (every {} ms)", idleConnTimeout); |
1495 | | - conman.closeIdleConnections(idleConnTimeout, TimeUnit.MILLISECONDS); |
1496 | | - } |
1497 | | - catch (Exception ex) |
1498 | | - { |
1499 | | - if (log.isErrorEnabled()) log.error("Error closing idle connections: {}", ex); |
1500 | | - } |
1501 | | - }, 0, idleConnTimeout, java.util.concurrent.TimeUnit.MILLISECONDS); |
1502 | 1469 |
|
1503 | 1470 | ClientConfig config = new ClientConfig(); |
1504 | 1471 | config.connectorProvider(new ApacheConnectorProvider()); |
|
0 commit comments