【发布时间】:2015-03-12 21:59:56
【问题描述】:
我正在尝试立即从下面的方法中获取响应并继续执行其余过程。但我看不到我的返回值“TestAync”。您能否建议如何从以下调用中检索(客户端代码)响应。
这是我正在打的客户电话,感谢您的帮助。 未来响应 = ClientBuilder.newClient().target("http://localhost:8080/testasync/test/async/test5").request().async().get();
@GET
@Path("async/{echo}")
public String asyncEcho(@PathParam("echo") final String echo, @Suspended final AsyncResponse ar) {
TASK_EXECUTOR.submit(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(SLEEP_TIME_IN_MILLIS);
} catch (InterruptedException ex) {
ar.cancel();
}
ar.resume(echo);
}
});
return "TestAysnc";
}
【问题讨论】:
标签: rest asynchronous jersey