|
|
|
@ -61,7 +61,7 @@ public class QuickstartCalleeController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private DataSourceProperties dataSourceProperties;
|
|
|
|
|
private boolean ifBadGateway = true;
|
|
|
|
|
private boolean ifDelay = false;
|
|
|
|
|
private int delay = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get sum of two value.
|
|
|
|
@ -111,8 +111,8 @@ public class QuickstartCalleeController {
|
|
|
|
|
LOG.info("Quickstart Callee Service [{}:{}] is called wrong.", ip, port);
|
|
|
|
|
return new ResponseEntity<>("failed for call quickstart callee service.", HttpStatus.BAD_GATEWAY);
|
|
|
|
|
}
|
|
|
|
|
if (ifDelay) {
|
|
|
|
|
Thread.sleep(200);
|
|
|
|
|
if (delay > 0) {
|
|
|
|
|
Thread.sleep(delay);
|
|
|
|
|
LOG.info("Quickstart Callee Service [{}:{}] is called slow.", ip, port);
|
|
|
|
|
return new ResponseEntity<>(String.format("Quickstart Callee Service [%s:%s] is called slow.", ip, port), HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
@ -131,8 +131,8 @@ public class QuickstartCalleeController {
|
|
|
|
|
LOG.info("Quickstart Callee Service with uid {} [{}:{}] is called wrong.", uid, ip, port);
|
|
|
|
|
return new ResponseEntity<>("failed for call quickstart callee service wildcard.", HttpStatus.BAD_GATEWAY);
|
|
|
|
|
}
|
|
|
|
|
if (ifDelay) {
|
|
|
|
|
Thread.sleep(200);
|
|
|
|
|
if (delay > 0) {
|
|
|
|
|
Thread.sleep(delay);
|
|
|
|
|
LOG.info("Quickstart Callee Service uid {} [{}:{}] is called slow.", uid, ip, port);
|
|
|
|
|
return new ResponseEntity<>(String.format("Quickstart Callee Service [%s:%s] is called slow.", ip, port), HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
@ -154,13 +154,14 @@ public class QuickstartCalleeController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/setDelay")
|
|
|
|
|
public String setDelay(@RequestParam boolean param) {
|
|
|
|
|
this.ifDelay = param;
|
|
|
|
|
if (param) {
|
|
|
|
|
LOG.info("info is set to delay 200ms.");
|
|
|
|
|
return "info is set to delay 200ms.";
|
|
|
|
|
public String setDelay(@RequestParam int param) {
|
|
|
|
|
this.delay = param;
|
|
|
|
|
if (delay > 0) {
|
|
|
|
|
LOG.info("info is set to delay {}ms.", delay);
|
|
|
|
|
return "info is set to delay " + delay + "ms.";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
delay = 0;
|
|
|
|
|
LOG.info("info is set to no delay.");
|
|
|
|
|
return "info is set to no delay.";
|
|
|
|
|
}
|
|
|
|
@ -172,8 +173,8 @@ public class QuickstartCalleeController {
|
|
|
|
|
LOG.info("Quickstart Callee Service [{}:{}] is detected wrong.", ip, port);
|
|
|
|
|
return new ResponseEntity<>(String.format("Quickstart Callee Service [%s:%s] is detected wrong.", ip, port), HttpStatus.BAD_GATEWAY);
|
|
|
|
|
}
|
|
|
|
|
if (ifDelay) {
|
|
|
|
|
Thread.sleep(200);
|
|
|
|
|
if (delay > 0) {
|
|
|
|
|
Thread.sleep(delay);
|
|
|
|
|
LOG.info("Quickstart Callee Service [{}:{}] is detected slow.", ip, port);
|
|
|
|
|
return new ResponseEntity<>(String.format("Quickstart Callee Service [%s:%s] is detected slow.", ip, port), HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|