🐛 Fixing a bug. #1534 amazonaws oss Unable to execute HTTP request: Timeout waiting for connection from pool

This commit is contained in:
冷冷 committed 2020-07-20 13:57:53 +08:00
1 parent 81af2b2dc8
commit ec3bbd900e
3 files changed
+13 -6

No files matched your search

@@ -77,4 +77,9 @@ public class OssProperties {
*/
private String bucketName = "payerp";
/**
* 最大线程数,默认: 100
*/
private Integer maxConnections = 100;
}
@@ -138,8 +138,8 @@ public class OssTemplate implements InitializingBean {
* API Documentation</a>
*/
@SneakyThrows
public InputStream getObject(String bucketName, String objectName) {
return amazonS3.getObject(bucketName, objectName).getObjectContent();
public S3Object getObject(String bucketName, String objectName) {
return amazonS3.getObject(bucketName, objectName);
}
/**
@@ -203,8 +203,10 @@ public class OssTemplate implements InitializingBean {
}
@Override
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setMaxConnections(ossProperties.getMaxConnections());
AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(
ossProperties.getEndpoint(), ossProperties.getRegion());
AWSCredentials awsCredentials = new BasicAWSCredentials(ossProperties.getAccessKey(),