You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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();
}
The text was updated successfully, but these errors were encountered:
public class ClientConfiguration {
...omit some code...
public static final int DEFAULT_CONNECTION_REQUEST_TIMEOUT = 5 * 60 * 1000;
public static final int DEFAULT_CONNECTION_TIMEOUT = 50 * 1000;
}
JokerForCode
added a commit
to JokerForCode/aliyun-oss-java-sdk
that referenced
this issue
Nov 12, 2021
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:
the wrong code to catch exception:
The text was updated successfully, but these errors were encountered: