По документам Джерси
По умолчанию тайм-аут не определен, т. Е. У клиента есть тайм-аут чтения и соединения бесконечности.
см. https://jersey.github.io/documentation/latest/async.html#d0e9989
Если вы хотите установить тайм-аут, вы можете обратиться к приведенному ниже фрагменту из документации Джерси
@GET
public void asyncGetWithTimeout(@Suspended final AsyncResponse asyncResponse) {
asyncResponse.setTimeoutHandler(new TimeoutHandler() {
@Override
public void handleTimeout(AsyncResponse asyncResponse) {
asyncResponse.resume(Response.status(Response.Status.SERVICE_UNAVAILABLE)
.entity("Operation time out.").build());
}
});
asyncResponse.setTimeout(20, TimeUnit.SECONDS);
new Thread(new Runnable() {
@Override
public void run() {
String result = veryExpensiveOperation();
asyncResponse.resume(result);
}
private String veryExpensiveOperation() {
// ... very expensive operation that typically finishes within 20 seconds
}
}).start();
}