本文整理了Java中org.apache.servicecomb.swagger.invocation.AsyncResponse.fail()
方法的一些代码示例,展示了AsyncResponse.fail()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AsyncResponse.fail()
方法的具体详情如下:
包路径:org.apache.servicecomb.swagger.invocation.AsyncResponse
类名称:AsyncResponse
方法名:fail
暂无
代码示例来源:origin: apache/servicecomb-java-chassis
@Override
public void handle(Invocation invocation, AsyncResponse asyncResp) {
HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation);
Observable<Response> observable = command.toObservable();
observable.subscribe(asyncResp::complete, error -> {
LOG.warn("catch error in bizkeeper:" + error.getMessage());
asyncResp.fail(invocation.getInvocationType(), error);
}, () -> {
});
}
代码示例来源:origin: apache/servicecomb-java-chassis
public void send(Invocation invocation, AsyncResponse asyncResp) {
URIEndpointObject endpoint = (URIEndpointObject) invocation.getEndpoint().getAddress();
HttpClientWithContext httpClientWithContext;
if (endpoint.isHttp2Enabled()) {
httpClientWithContext = findHttp2ClientPool(invocation);
} else {
httpClientWithContext = findHttpClientPool(invocation);
}
RestClientInvocation restClientInvocation = new RestClientInvocation(httpClientWithContext, httpClientFilters);
try {
restClientInvocation.invoke(invocation, asyncResp);
} catch (Throwable e) {
asyncResp.fail(invocation.getInvocationType(), e);
LOGGER.error("vertx rest transport send error.", e);
}
}
代码示例来源:origin: apache/servicecomb-java-chassis
protected void fail(Throwable e) {
if (invocation.isFinished()) {
return;
}
InvocationStageTrace stageTrace = invocation.getInvocationStageTrace();
ConnectionBase connection = (ConnectionBase) clientRequest.connection();
// connection maybe null when exception happens such as ssl handshake failure
if (connection != null) {
DefaultHttpSocketMetric httpSocketMetric = (DefaultHttpSocketMetric) connection.metric();
stageTrace.finishGetConnection(httpSocketMetric.getRequestBeginTime());
stageTrace.finishWriteToBuffer(httpSocketMetric.getRequestEndTime());
}
// even failed and did not received response, still set time for it
// that will help to know the real timeout time
if (stageTrace.getFinishReceiveResponse() == 0) {
stageTrace.finishReceiveResponse();
}
if (stageTrace.getStartClientFiltersResponse() == 0) {
stageTrace.startClientFiltersResponse();
}
stageTrace.finishClientFiltersResponse();
asyncResp.fail(invocation.getInvocationType(), e);
}
代码示例来源:origin: org.apache.servicecomb/handler-bizkeeper
@Override
public void handle(Invocation invocation, AsyncResponse asyncResp) {
HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation);
Observable<Response> observable = command.toObservable();
observable.subscribe(asyncResp::complete, error -> {
LOG.warn("catch error in bizkeeper:" + error.getMessage());
asyncResp.fail(invocation.getInvocationType(), error);
}, () -> {
});
}
代码示例来源:origin: org.apache.servicecomb/transport-rest-client
public void send(Invocation invocation, AsyncResponse asyncResp) {
URIEndpointObject endpoint = (URIEndpointObject) invocation.getEndpoint().getAddress();
HttpClientWithContext httpClientWithContext;
if (endpoint.isHttp2Enabled()) {
httpClientWithContext = findHttp2ClientPool(invocation);
} else {
httpClientWithContext = findHttpClientPool(invocation);
}
RestClientInvocation restClientInvocation = new RestClientInvocation(httpClientWithContext, httpClientFilters);
try {
restClientInvocation.invoke(invocation, asyncResp);
} catch (Throwable e) {
asyncResp.fail(invocation.getInvocationType(), e);
LOGGER.error("vertx rest transport send error.", e);
}
}
代码示例来源:origin: org.apache.servicecomb/transport-rest-client
protected void fail(Throwable e) {
if (invocation.isFinished()) {
return;
}
InvocationStageTrace stageTrace = invocation.getInvocationStageTrace();
ConnectionBase connection = (ConnectionBase) clientRequest.connection();
// connection maybe null when exception happens such as ssl handshake failure
if (connection != null) {
DefaultHttpSocketMetric httpSocketMetric = (DefaultHttpSocketMetric) connection.metric();
stageTrace.finishGetConnection(httpSocketMetric.getRequestBeginTime());
stageTrace.finishWriteToBuffer(httpSocketMetric.getRequestEndTime());
}
// even failed and did not received response, still set time for it
// that will help to know the real timeout time
if (stageTrace.getFinishReceiveResponse() == 0) {
stageTrace.finishReceiveResponse();
}
if (stageTrace.getStartClientFiltersResponse() == 0) {
stageTrace.startClientFiltersResponse();
}
stageTrace.finishClientFiltersResponse();
asyncResp.fail(invocation.getInvocationType(), e);
}
内容来源于网络,如有侵权,请联系作者删除!