Skip to content

Commit

Permalink
Removed idleConnectionMonitor
Browse files Browse the repository at this point in the history
  • Loading branch information
namedgraph committed Dec 10, 2024
1 parent 262fca7 commit 911cd7b
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions src/main/java/com/atomgraph/linkeddatahub/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -1387,21 +1387,21 @@ public void releaseConnection(final HttpClientConnection managedConn, final Obje
if (maxTotalConn != null) conman.setMaxTotal(maxTotalConn);
conman.setValidateAfterInactivity(30000); // check connections idle for more than Varnish's idle_timeout which is 5s

Integer idleConnTimeout = 4000;
// Integer idleConnTimeout = 4000;
// create monitor thread that evicts idle connections: https://hc.apache.org/httpcomponents-client-4.5.x/current/tutorial/html/connmgmt.html#d5e418
ScheduledExecutorService idleConnectionMonitor = Executors.newSingleThreadScheduledExecutor();
idleConnectionMonitor.scheduleAtFixedRate(() ->
{
try
{
if (log.isDebugEnabled()) log.debug("Evicting idle HTTP connections (every {} ms)", idleConnTimeout);
conman.closeIdleConnections(idleConnTimeout, TimeUnit.MILLISECONDS);
}
catch (Exception ex)
{
if (log.isErrorEnabled()) log.error("Error closing idle connections: {}", ex);
}
}, 0, idleConnTimeout, java.util.concurrent.TimeUnit.MILLISECONDS);
// ScheduledExecutorService idleConnectionMonitor = Executors.newSingleThreadScheduledExecutor();
// idleConnectionMonitor.scheduleAtFixedRate(() ->
// {
// try
// {
// if (log.isDebugEnabled()) log.debug("Evicting idle HTTP connections (every {} ms)", idleConnTimeout);
// conman.closeIdleConnections(idleConnTimeout, TimeUnit.MILLISECONDS);
// }
// catch (Exception ex)
// {
// if (log.isErrorEnabled()) log.error("Error closing idle connections: {}", ex);
// }
// }, 0, idleConnTimeout, java.util.concurrent.TimeUnit.MILLISECONDS);

ClientConfig config = new ClientConfig();
config.connectorProvider(new ApacheConnectorProvider());
Expand Down Expand Up @@ -1485,21 +1485,21 @@ public void releaseConnection(final HttpClientConnection managedConn, final Obje
if (maxTotalConn != null) conman.setMaxTotal(maxTotalConn);
conman.setValidateAfterInactivity(30000); // check connections idle for more than Varnish's idle_timeout which is 5s

Integer idleConnTimeout = 4000;
// Integer idleConnTimeout = 4000;
// create monitor thread that evicts idle connections: https://hc.apache.org/httpcomponents-client-4.5.x/current/tutorial/html/connmgmt.html#d5e418
ScheduledExecutorService idleConnectionMonitor = Executors.newSingleThreadScheduledExecutor();
idleConnectionMonitor.scheduleAtFixedRate(() ->
{
try
{
if (log.isDebugEnabled()) log.debug("Evicting idle HTTP connections (every {} ms)", idleConnTimeout);
conman.closeIdleConnections(idleConnTimeout, TimeUnit.MILLISECONDS);
}
catch (Exception ex)
{
if (log.isErrorEnabled()) log.error("Error closing idle connections: {}", ex);
}
}, 0, idleConnTimeout, java.util.concurrent.TimeUnit.MILLISECONDS);
// ScheduledExecutorService idleConnectionMonitor = Executors.newSingleThreadScheduledExecutor();
// idleConnectionMonitor.scheduleAtFixedRate(() ->
// {
// try
// {
// if (log.isDebugEnabled()) log.debug("Evicting idle HTTP connections (every {} ms)", idleConnTimeout);
// conman.closeIdleConnections(idleConnTimeout, TimeUnit.MILLISECONDS);
// }
// catch (Exception ex)
// {
// if (log.isErrorEnabled()) log.error("Error closing idle connections: {}", ex);
// }
// }, 0, idleConnTimeout, java.util.concurrent.TimeUnit.MILLISECONDS);

ClientConfig config = new ClientConfig();
config.connectorProvider(new ApacheConnectorProvider());
Expand Down

0 comments on commit 911cd7b

Please sign in to comment.