有没有办法判断AmazonS3Client是否已关闭?
以下是我想要实现的场景,以避免每次创建新客户端,并确保如果某些其他组件误关闭它,则不会破坏下一个请求。
private AmazonS3ClientBuilder createBuilder() {
return AmazonS3ClientBuilder.standard()
.withCredentials(InstanceProfileCredentialsProvider.getInstance();)
.withRegion(clientRegion);
}
public synchronized AmazonS3 buildAmazonClient() {
if (s3Client == null || s3Client.*IS_SHUTDOWN?*)
s3Client = buildAmazonClient();
return s3Client;
}
shutdown()
方法,而我已经在其上构建了应用程序。AWS-SDK真是一团糟。 - chrylis -cautiouslyoptimistic-