use of com.github.df.restypass.exception.execute.ConnectionException in project RestyPass by darren-fu.
the class RestyFuture method get.
@Override
public T get() throws RestyException {
Response response;
try {
response = future.get();
} catch (InterruptedException | ExecutionException e) {
future.abort(e);
log.warn("获取响应失败:{}", e.getMessage());
if (this.getRestyCommand().isAsyncArg() || this.getRestyCommand().isAsyncReturn()) {
throw new RestyException(e);
}
response = FailedResponse.create(new ConnectionException(e));
}
T resp = (T) ResponseConverterContext.DEFAULT.convertResponse(restyCommand, response);
if (restyCommand.isAsyncReturn() || restyCommand.isAsyncArg()) {
if (RestyCommandStatus.FAILED == restyCommand.getStatus() && restyCommand.getFailException() != null) {
throw restyCommand.getFailException();
}
}
return resp;
}
use of com.github.df.restypass.exception.execute.ConnectionException in project RestyPass by darren-fu.
the class RestyFuture method get.
@SuppressWarnings("NullableProblems")
@Override
public T get(long timeout, TimeUnit unit) throws RestyException {
Response response;
try {
response = future.get(timeout, unit);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
future.abort(e);
log.error("获取响应失败:{}", e.getMessage());
if (this.getRestyCommand().isAsyncArg() || this.getRestyCommand().isAsyncReturn()) {
throw new RestyException(e);
}
response = FailedResponse.create(new ConnectionException(e));
}
T resp = (T) ResponseConverterContext.DEFAULT.convertResponse(restyCommand, response);
if (restyCommand.isAsyncReturn() || restyCommand.isAsyncArg()) {
if (RestyCommandStatus.FAILED == restyCommand.getStatus() && restyCommand.getFailException() != null) {
throw restyCommand.getFailException();
}
}
return resp;
}
Aggregations