本文整理匯總了Java中io.vertx.core.AsyncResult.failed方法的典型用法代碼示例。如果您正苦於以下問題:Java AsyncResult.failed方法的具體用法?Java AsyncResult.failed怎麽用?Java AsyncResult.failed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.vertx.core.AsyncResult
的用法示例。
在下文中一共展示了AsyncResult.failed方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: afterReadInEventloop
import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
private synchronized void afterReadInEventloop(AsyncResult<ReadResult> ar) {
if (ar.failed()) {
exceptionHandler.handle(ar.cause());
return;
}
readInProgress = false;
ReadResult readResult = ar.result();
if (readResult.readed < 0) {
handleEnd();
return;
}
handleData(readResult.toBuffer());
if (!paused && dataHandler != null) {
doRead();
}
}
示例2: onLoginResponse
import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
private void onLoginResponse(AsyncResult<TcpData> asyncResult) {
if (asyncResult.failed()) {
LOGGER.error("login failed, address {}", socketAddress.toString(), asyncResult.cause());
// 在相應回調中設置狀態
netSocket.close();
return;
}
if (!onLoginResponse(asyncResult.result().getBodyBuffer())) {
LOGGER.error("login failed, address {}", socketAddress.toString());
// 在相應回調中設置狀態
netSocket.close();
return;
}
LOGGER.info("login success, address {}", socketAddress.toString());
onLoginSuccess();
}
示例3: handleConnectResult
import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
private void handleConnectResult(AsyncResult<NetSocket> res)
{
if (res.failed()) {
log.error(format("Connection to gpsd server %s:%d failed", serverHost, serverPort), res.cause());
this.startingLock.unlockWrite(this.startingLockStamp);
this.stop();
return;
}
this.clientSocket = res.result()
.closeHandler(__ -> handleClose())
.handler(buf -> {
// Split new lines in case the buffer contains multiple JSON objects
String[] split = buf.toString().split("(\\r\\n|\\r|\\n)+");
for (String s : split) handleJsonString(s);
});
this.running = true;
this.startingLock.unlockWrite(this.startingLockStamp);
log.info("Successfully connected to gpsd server {}:{}", serverHost, serverPort);
this.executeBlockingHandler(this.successfulConnectionHandler, this, false);
}
示例4: handler
import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
@SuppressWarnings("rawtypes")
protected void handler(AsyncResult<?> asyncResult) {
if (asyncResult.failed()) {
log.error("AsyncResult failed", asyncResult.cause());
error(asyncResult.cause());
return;
}
if (asyncResult.result().getClass().equals(Optional.class) && !((Optional) asyncResult.result()).isPresent()) {
noContent();
return;
}
if(asyncResult.result() == null){
success();
}
else{
success(asyncResult.result());
}
}
示例5: handle
import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
@Override
public void handle(AsyncResult<Boolean> res) {
if (res.failed()) {
cursor = null;
Handler<Throwable> handler = exceptionHandler;
if (handler != null) {
handler.handle(res.cause());
}
close();
} else {
this.suspended = res.result();
checkPending();
}
}
示例6: handleAuthentication
import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
private void handleAuthentication(AsyncResult<JsonObject> resultHandler) {
if (resultHandler.failed()) {
unauthorized(resultHandler.cause());
return;
}
JsonObject jwtOptions = vertx.getOrCreateContext().config().getJsonObject("jwtOptions", new JsonObject().put("expiresInSeconds", 60));
JWTOptions options = new JWTOptions().setExpiresInSeconds(jwtOptions.getLong("expiresInSeconds"));
JsonObject user = resultHandler.result();
String jwt = jwtAuth.getJWTAuth().generateToken(user, options);
success(new JsonObject().put("jwt", jwt));
}