SDK Clients are `Closeable` and documented as thread safe but don't provide an `isClosed()` method
Describe the bug
Because SDK clients are Closeable they might be auto-closed if placed in a "try with resources" block. The SDK documentation encourages re-use of clients and advertises them as thread safe. This can mean another thread or a try with resources block might close a client without you realizing. Unfortunately you cannot check if the client is still open because there is no isClosed() method.
Expected Behavior
Ability to determine if a client is closed.
Current Behavior
No ability to determine if a client is closed (without making an API call).
Reproduction Steps
S3Client client;
// on another thread
try (client = S3Client.builder().build()) {
// do some things
}
// back on the main thread the client has been auto closed but you don't know and cannot tell
client.headBucketRequest(...); // will fail
### Possible Solution
* presence of an `isClosed()` method
* Or, to make it truly safe, future calls to a closed client could automatically re-establish a connection pool internally
### Additional Information/Context
_No response_
### AWS Java SDK version used
2.25.51
### JDK version used
OpenJDK Runtime Environment Corretto-17.0.11.9.1 (build 17.0.11+9-LTS)
### Operating System and version
Mac OS 14.4.1 (23E224)
@markjschreiber feature request acknowledged, added to the backlog.
Additionally it will also allow skipping of redundant clean up. We for certain code paths have not been able to implement the AutoClosable interface. But we have made sure to manually close the sdk object and redundancies for it.
Having an isClosed will allow us to skip these redundant closures.
Using profiling I found that creating a client can be very expensive (around 1000 milliseconds) therefore I would like to be able to re-use them as often as possible but would need to be able to ensure they are not closed.