Skip to content

Commit

Permalink
Use default PoolingHttpClientConnectionManager
Browse files Browse the repository at this point in the history
  • Loading branch information
namedgraph committed Nov 27, 2024
1 parent 78c5c55 commit 54f5c16
Showing 1 changed file with 29 additions and 28 deletions.
57 changes: 29 additions & 28 deletions src/main/java/com/atomgraph/linkeddatahub/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -1353,35 +1353,36 @@ public static Client getClient(KeyStore keyStore, String keyStorePassword, KeySt
register("http", new PlainConnectionSocketFactory()).
build();

PoolingHttpClientConnectionManager conman = new PoolingHttpClientConnectionManager(socketFactoryRegistry)
{

// https://github.com/eclipse-ee4j/jersey/issues/4449

@Override
public void close()
{
super.shutdown();
}

@Override
public void shutdown()
{
// Disable shutdown of the pool. This will be done later, when this factory is closed
// This is a workaround for finalize method on jerseys ClientRuntime which
// closes the client and shuts down the connection pool when it is garbage collected
};

// https://github.com/eclipse-ee4j/jersey/issues/2855

@Override
public void releaseConnection(final HttpClientConnection managedConn, final Object state, final long keepalive, final TimeUnit timeUnit)
{
// set state to null to allow reuse of connections
super.releaseConnection(managedConn, null, keepalive, timeUnit);
}
PoolingHttpClientConnectionManager conman = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
// {
//
// // https://github.com/eclipse-ee4j/jersey/issues/4449
//
// @Override
// public void close()
// {
// super.shutdown();
// }
//
// @Override
// public void shutdown()
// {
// // Disable shutdown of the pool. This will be done later, when this factory is closed
// // This is a workaround for finalize method on jerseys ClientRuntime which
// // closes the client and shuts down the connection pool when it is garbage collected
// };
//
// // https://github.com/eclipse-ee4j/jersey/issues/2855
//
// @Override
// public void releaseConnection(final HttpClientConnection managedConn, final Object state, final long keepalive, final TimeUnit timeUnit)
// {
// // set state to null to allow reuse of connections
// super.releaseConnection(managedConn, null, keepalive, timeUnit);
// }
//
// };

};
if (maxConnPerRoute != null) conman.setDefaultMaxPerRoute(maxConnPerRoute);
if (maxTotalConn != null) conman.setMaxTotal(maxTotalConn);

Expand Down

0 comments on commit 54f5c16

Please sign in to comment.