|
@@ -0,0 +1,33 @@
|
|
|
+package cn.gygxzc.cloud.tina.eureka.web.test;
|
|
|
+
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @program: Envir_Registry
|
|
|
+ * @description: ${description}
|
|
|
+ * @author: tuonina
|
|
|
+ * @create: 2019-04-27 11:33
|
|
|
+ **/
|
|
|
+@RestController
|
|
|
+@RequestMapping("/test/retry")
|
|
|
+public class RetryController {
|
|
|
+
|
|
|
+ private AtomicInteger count = new AtomicInteger(0);
|
|
|
+ private Logger logger = LoggerFactory.getLogger(RetryController.class);
|
|
|
+
|
|
|
+ @GetMapping
|
|
|
+ public String retryTest() {
|
|
|
+ int num = count.incrementAndGet();
|
|
|
+ logger.info("当前次数: {}", num);
|
|
|
+ if (num % 3 != 0) {
|
|
|
+ throw new RuntimeException("出错了!");
|
|
|
+ }
|
|
|
+ return "我们都是中国人!";
|
|
|
+ }
|
|
|
+}
|