--effect-count string 影响的请求条数
--effect-percent string 影响的请求百分比
--time string 延迟时间,单位是毫秒,必填项
--offset string 延迟时间上下偏移量,比如 --time 3000 --offset 1000,则延迟时间范围是 2000-4000 毫秒
@RequestMapping(value = "async")
@ResponseBody
public String asyncHello(final String name, long timeout) {
if (timeout == 0) {
timeout = 3000;
}
try {
FutureTask futureTask = new FutureTask(new Callable() {
@Override
public Object call() throws Exception {
return sayHello(name);
}
});
new Thread(futureTask).start();
return (String)futureTask.get(timeout, TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
return "timeout, " + e.getMessage() + "\n";
} catch (Exception e) {
return e.getMessage() + "\n";
}
}
blade c jvm delay --time 4000 --classname=com.example.controller.DubboController --methodname=sayHello --process tomcat
{"code":200,"success":true,"result":"d6ebea0dc28b6ab3"}