I'm using S3Client from Java SDK v2. to upload/download files from AWS S3 in a distributed web application.
I had a problem with idle-connection-reaper daemon thread preventing/delaying the class from being unloaded during shutdown. I did some investigations and I figured out that in AWS Java SDK v1, this could be resolved by calling IdleConnectionReaper.shutdown() method.
I imported apache client to my project
<!-- https://mvnrepository.com/artifact/software.amazon.awssdk/apache-client -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
<version>2.17.162</version>
</dependency>
And I would like to do the same thing using AWS Java SDK v2. The problem is that shutdown() method is no longer static and exposed.
They changed the class to a Singleton and the only exposed APIs are:
public synchronized boolean registerConnectionManager(HttpClientConnectionManager manager, long maxIdleTime)
public synchronized boolean deregisterConnectionManager(HttpClientConnectionManager manager)
deregisterConnectionManager() calls shutdown internally but I don't know what HttpClientConnectionManager I should give as an argument for both methods
My question is: Is there another approach to shutdown that daemon thread or I should stick to the new implementation of IdleConnectionReaper? If so, what are exactly HttpClientConnectionManager parameter in both registerConnectionManager and deregisterConnectionManager methods?