@@ -31,6 +31,11 @@ public class ClientConfiguration {
3131 * 默认自动更新签名
3232 */
3333 public static final boolean DEFAULT_RENEW_SIG = true ;
34+
35+ /**
36+ * 默认业务错误码重试开关关闭
37+ */
38+ public static final boolean DEFAULT_ENABLE_BUSINESS_RETRY = false ;
3439 /**
3540 * 默认超时时间(毫秒)
3641 */
@@ -57,14 +62,15 @@ public class ClientConfiguration {
5762 private long callTimeout = DEFAULT_CALL_TIMEOUT ;
5863 private long expireTime = DEFAULT_EXPIRE_TIME ;
5964 private boolean autoRenewSig = DEFAULT_RENEW_SIG ;
65+ private boolean enableBusinessRetry = DEFAULT_ENABLE_BUSINESS_RETRY ;
6066 private String userAgent = DEFAULT_USER_AGENT ;
6167 private ConnectionPool connectionPool = DEFAULT_CONNECTION_POOL ;
6268
6369 public ClientConfiguration () {
6470 }
6571
6672 public ClientConfiguration (int maxRetries , long retryIntervalMs , long connectTimeout , long readTimeout , long writeTimeout ,
67- long callTimeout , long expireTime , boolean autoRenewSig ,
73+ long callTimeout , long expireTime , boolean autoRenewSig , boolean enableBusinessRetry ,
6874 String userAgent , ConnectionPool connectionPool ) {
6975 if (connectionPool == null ) {
7076 connectionPool = DEFAULT_CONNECTION_POOL ;
@@ -77,6 +83,7 @@ public ClientConfiguration(int maxRetries, long retryIntervalMs, long connectTim
7783 this .callTimeout = callTimeout ;
7884 this .expireTime = expireTime ;
7985 this .autoRenewSig = autoRenewSig ;
86+ this .enableBusinessRetry = enableBusinessRetry ;
8087 this .userAgent = userAgent ;
8188 this .connectionPool = connectionPool ;
8289 }
@@ -90,6 +97,7 @@ private ClientConfiguration(Builder builder) {
9097 this .callTimeout = builder .callTimeout ;
9198 this .expireTime = builder .expireTime ;
9299 this .autoRenewSig = builder .autoRenewSig ;
100+ this .enableBusinessRetry = builder .enableBusinessRetry ;
93101 this .userAgent = builder .userAgent ;
94102 this .connectionPool = builder .connectionPool ;
95103 }
@@ -162,6 +170,14 @@ public void setAutoRenewSig(boolean autoRenewSig) {
162170 this .autoRenewSig = autoRenewSig ;
163171 }
164172
173+ public boolean isEnableBusinessRetry () {
174+ return enableBusinessRetry ;
175+ }
176+
177+ public void setEnableBusinessRetry (boolean enableBusinessRetry ) {
178+ this .enableBusinessRetry = enableBusinessRetry ;
179+ }
180+
165181 public String getUserAgent () {
166182 return userAgent ;
167183 }
@@ -215,6 +231,9 @@ public boolean equals(Object o) {
215231 if (autoRenewSig != that .autoRenewSig ) {
216232 return false ;
217233 }
234+ if (enableBusinessRetry != that .enableBusinessRetry ) {
235+ return false ;
236+ }
218237 if (!userAgent .equals (that .userAgent )) {
219238 return false ;
220239 }
@@ -223,7 +242,7 @@ public boolean equals(Object o) {
223242
224243 @ Override
225244 public int hashCode () {
226- return Objects .hash (maxRetries , retryIntervalMs , connectTimeout , readTimeout , writeTimeout , callTimeout , expireTime , autoRenewSig , userAgent , connectionPool );
245+ return Objects .hash (maxRetries , retryIntervalMs , connectTimeout , readTimeout , writeTimeout , callTimeout , expireTime , autoRenewSig , enableBusinessRetry , userAgent , connectionPool );
227246 }
228247
229248 public static final class Builder {
@@ -235,6 +254,7 @@ public static final class Builder {
235254 private long callTimeout = DEFAULT_CALL_TIMEOUT ;
236255 private long expireTime = DEFAULT_EXPIRE_TIME ;
237256 private boolean autoRenewSig = DEFAULT_RENEW_SIG ;
257+ private boolean enableBusinessRetry = DEFAULT_ENABLE_BUSINESS_RETRY ;
238258 private String userAgent = DEFAULT_USER_AGENT ;
239259 private ConnectionPool connectionPool = DEFAULT_CONNECTION_POOL ;
240260
@@ -285,6 +305,11 @@ public Builder autoRenewSig(boolean autoRenewSig) {
285305 return this ;
286306 }
287307
308+ public Builder enableBusinessRetry (boolean enableBusinessRetry ) {
309+ this .enableBusinessRetry = enableBusinessRetry ;
310+ return this ;
311+ }
312+
288313 public Builder userAgent (String userAgent ) {
289314 this .userAgent = userAgent ;
290315 return this ;
0 commit comments