I am using AWS SDK to make calls to an appsync endpoint. However, I am unable to understand the significance of needsConnectionLeftOpen in this javadoc: https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/http/HttpResponseHandler.html#needsConnectionLeftOpen--
Does this mean, that the HTTP connection closes regardless of whatever connMaxIdleMillis I specify in Client Configuration ?
final ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setMaxConnections(50);
clientConfiguration.setConnectionMaxIdleMillis(300000);
The HTTP connections created by any response handler that is marked as needsConnectionLeftOpen
is not affected by connectionMaxIdleMillis
as you've effectively marked the connections as self-managed. You've confirmed that you don't want the library to handle the connection and that you'll close it yourself.
The connectionMaxIdleMillis
parameter only applies to connections that are not kept open, not in use by the response handler and that are idle in the connection pool.
It doesn't affect connections that are kept open by the needsConnectionLeftOpen
setting.
The typical usage for needsConnectionLeftOpen
is detailed in the docs:
For example, if the object returned by this response handler manually manages the stream of data from the HTTP connection, and doesn't read all the data from the connection in the handle(HttpResponse) method, this method can be used to prevent the underlying connection from being prematurely closed.