File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
springboot-starter/src/main/java/com/codingapi/springboot/framework/rest Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 1
1
package com .codingapi .springboot .framework .rest ;
2
2
3
+ import com .alibaba .fastjson .JSONObject ;
3
4
import com .codingapi .springboot .framework .rest .param .ApiGetParamBuilder ;
4
5
import com .codingapi .springboot .framework .rest .param .ApiPostParamBuilder ;
5
6
import com .codingapi .springboot .framework .rest .properties .RestApiProperties ;
@@ -43,7 +44,25 @@ public String get(String api) {
43
44
}
44
45
45
46
private String _post (String api , ApiPostParamBuilder paramBuilder ) {
46
- return httpClient .post (api , paramBuilder .build ());
47
+ return _post (api , paramBuilder .build ());
48
+ }
49
+
50
+
51
+ private String _post (String api , JSONObject requestBody ) {
52
+ return httpClient .post (api , requestBody );
53
+ }
54
+
55
+
56
+ public String post (String api , JSONObject requestBody ) {
57
+ for (int i =0 ;i < RETRY_COUNT ;i ++){
58
+ try {
59
+ return _post (api , requestBody );
60
+ }catch (Exception e ){
61
+ log .warn ("api:{},error:{}" ,api ,e .getMessage ());
62
+ sleep ();
63
+ }
64
+ }
65
+ return EMPTY ;
47
66
}
48
67
49
68
You can’t perform that action at this time.
0 commit comments