Skip to content

Commit ada3aa7

Browse files
committed
add custom resource to C
1 parent 858ffff commit ada3aa7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

mse-simple-demo/C/src/main/java/com/alibabacloud/mse/demo/c/CController.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,17 @@ public String c(HttpServletRequest request) {
6161
if (throwException) {
6262
throw new RuntimeException();
6363
}
64-
return "C" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]";
64+
try (Entry entry1 = SphU.entry("HelloWorld-c-1", EntryType.IN)) {
65+
log.debug("Hello Sentinel!1");
66+
try (Entry entry2 = SphU.entry("H\"elloWorld-c-2", EntryType.IN)) {
67+
log.debug("Hello Sentinel!2");
68+
return "C" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]";
69+
} catch (BlockException e) {
70+
throw new RuntimeException(e);
71+
}
72+
} catch (BlockException e) {
73+
throw new RuntimeException(e);
74+
}
6575
}
6676

6777
@GetMapping("/c-zone")

0 commit comments

Comments
 (0)