本文整理匯總了Java中io.vertx.core.AsyncResult.cause方法的典型用法代碼示例。如果您正苦於以下問題:Java AsyncResult.cause方法的具體用法?Java AsyncResult.cause怎麽用?Java AsyncResult.cause使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.vertx.core.AsyncResult
的用法示例。
在下文中一共展示了AsyncResult.cause方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: replyJson
import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
public void replyJson(
final Future<JsonObject> handler,
final AsyncResult<IpcResponse> response) {
if (response.succeeded()) {
final Envelop json = DataEncap.out(response.result());
final JsonObject data = json.data();
LOGGER.info(Info.CLIENT_RESPONSE, data);
handler.complete(data);
} else {
final Throwable ex = response.cause();
if (null != ex) {
final Envelop envelop =
Envelop.failure(new _500UnexpectedRpcException(this.clazz, ex));
handler.complete(new JsonObject(envelop.response()));
}
}
}
示例2: reply
import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
public void reply(
final Future<Envelop> handler,
final AsyncResult<IpcResponse> response
) {
if (response.succeeded()) {
handler.complete(DataEncap.out(response.result()));
} else {
final Throwable ex = response.cause();
if (null != ex) {
final Envelop envelop =
Envelop.failure(new _500UnexpectedRpcException(this.clazz, ex));
handler.complete(envelop);
}
}
}
示例3: handle
import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
@Override
public void handle(AsyncResult<Connection> ar) {
if (ar.succeeded()) {
conn = ar.result();
} else {
acquireFailure = ar.cause();
}
}
示例4: forwardErrorCode
import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
private void forwardErrorCode(RoutingContext routingContext, AsyncResult<Message<Object>> reply) {
ReplyException ex = (ReplyException) reply.cause();
ex.printStackTrace();
HttpServerResponse response = routingContext.response();
response.setStatusCode(ex.failureCode());
response.end();
}