當前位置: 首頁>>代碼示例>>Java>>正文


Java AsyncResult.failed方法代碼示例

本文整理匯總了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();
  }
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:19,代碼來源:InputStreamToReadStream.java

示例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();
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:19,代碼來源:TcpClientConnection.java

示例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);
}
 
開發者ID:ivkos,項目名稱:gpsd4j,代碼行數:27,代碼來源:GpsdClient.java

示例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());
	}
}
 
開發者ID:pflima92,項目名稱:jspare-vertx-ms-blueprint,代碼行數:26,代碼來源:RestAPIHandler.java

示例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();
  }
}
 
開發者ID:vietj,項目名稱:reactive-pg-client,代碼行數:15,代碼來源:PgCursorStreamImpl.java

示例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));
	}
 
開發者ID:pflima92,項目名稱:jspare-vertx-ms-blueprint,代碼行數:15,代碼來源:UAARoute.java


注:本文中的io.vertx.core.AsyncResult.failed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。