Open
Description
Only set up the variable "requestTimeoutEnabled" and "requestTimeout" both of “ClientBuilderConfiguration”,the ossClient will be block until time-out,and throw timeoutException.However, the “requestTimeoutEnabled” is set up "false", or the "requestTimeout" is set up 'null',the request of OSS Http will occur timeout,but in the code,it never throw exception,the thread will be block until dead.
the right code to catch exception:
ClientBuilderConfiguration configuration = new ClientBuilderConfiguration();
configuration.setRequestTimeoutEnabled(Boolean.TRUE);
configuration.setRequestTimeout(300_000);
OSS aliyunOssClient = new OSSClientBuilder().build(xxx,xxx,xxx,configuration);
try{
String fileUrl = aliyunOssClient.getObject(bucketName,filePath).getResponse().getUri();
}catch (Throwable cause){
// here will be catch
cause.printStackTrace();
}
the wrong code to catch exception:
OSS aliyunOssClient = new OSSClientBuilder().build(xxx,xxx,xxx);
try{
String fileUrl = aliyunOssClient.getObject(bucketName,filePath).getResponse().getUri();
}catch (Throwable cause){
// here will not be catch,the thread will be block until dead
cause.printStackTrace();
}
Metadata
Metadata
Assignees
Labels
No labels