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


Java AsyncResult.result方法代碼示例

本文整理匯總了Java中io.vertx.core.AsyncResult.result方法的典型用法代碼示例。如果您正苦於以下問題:Java AsyncResult.result方法的具體用法?Java AsyncResult.result怎麽用?Java AsyncResult.result使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.vertx.core.AsyncResult的用法示例。


在下文中一共展示了AsyncResult.result方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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

示例3: doDispatch

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
private <T> void doDispatch(Future<T> future, Buffer buffer, AsyncResult<Record> resultHandler) {
	
	AuditFuture audit = AuditFuture.create(context).saveRequest(buffer.copy());
	if (resultHandler.succeeded()) {

		Record record = resultHandler.result();
		proxyService.proxy(context, record, buffer).setHandler(ar -> {
			
			audit.saveResponse(record,  ar.result());
			future.complete();
		});
	} else {

		audit.saveResponse(resultHandler.cause());
		future.fail(resultHandler.cause());
	}
}
 
開發者ID:pflima92,項目名稱:jspare-vertx-ms-blueprint,代碼行數:18,代碼來源:GatewayProxyRoute.java

示例4: onGetResponse

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
private void onGetResponse(AsyncResult<String> ar) {
  if (ar.succeeded()) {
    if (ar.result() == null) {
      createCache();
      return;
    }

    future.complete(ar.result());
    return;
  }

  future.completeExceptionally(ar.cause());
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:14,代碼來源:RedisSession.java

示例5: processResponse

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
private JsonArray processResponse(final Range range,
                                  final Function<Range, List<Range>> rangeSplitter,
                                  final JsonArray targets,
                                  final AsyncResult<List<JsonObject>> result) {

    final List<Range> intervals = rangeSplitter.apply(range);
    final List<JsonObject> datapoints = result.result();

    return targets.stream()
                  .parallel()
                  .map(Object::toString)
                  .flatMap(targetName -> calculatePecentileForTarget(targetName, intervals, datapoints))
                  .collect(new DatapointsResultCollector());
}
 
開發者ID:gmuecke,項目名稱:grafana-vertx-datasource,代碼行數:15,代碼來源:PercentilesVerticle.java

示例6: handle

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
public void handle(AsyncResult<NetSocket> result) {
        NetSocket socket = result.result();

        //read data
        socket.handler(new Handler<Buffer>(){
            @Override
            public void handle(Buffer buffer) {
                System.out.println("Received data length: " + buffer.length());

                String data = buffer.getString(0, buffer.length());
                System.out.println("Received data: " + data);

            }
        });


//        JsonObject jsonObject = new JsonObject();
//        for (int i = 0; i < 500; i++){
//            jsonObject.put("" + i, i);
//        }
//        FrameHelper.writeFrame(jsonObject, socket);


        PersonDomain.Person.Builder builder = PersonDomain.Person.newBuilder();
        builder.setId(1);
        builder.setName("zzqfsy");
        builder.setEmail("[email protected]");
        PersonDomain.Person person = builder.build();
        FrameHelper.writeFrame(person.toByteArray(), socket);

        socket.exceptionHandler(t -> {
            System.out.println(t.getMessage());
            socket.close();
        });

        socket.endHandler(v -> {
        });
    }
 
開發者ID:zzqfsy,項目名稱:spring-vertx-tcp,代碼行數:39,代碼來源:VertxTcpClientVerticle.java

示例7: success

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
protected Envelop success(final String address,
                          final AsyncResult<Message<Envelop>> handler
) {
    Envelop envelop;
    try {
        final Message<Envelop> message = handler.result();
        envelop = message.body();
    } catch (final Throwable ex) {
        final WebException error
                = new _500EntityCastException(this.getClass(),
                address, ex.getMessage());
        envelop = Envelop.failure(error);
    }
    return envelop;
}
 
開發者ID:silentbalanceyh,項目名稱:vertx-zero,代碼行數:16,代碼來源:BaseAim.java

示例8: handle

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
@Override
public void handle(AsyncResult<Connection> ar) {
  if (ar.succeeded()) {
    Connection conn = ar.result();
    this.conn = conn;
    conn.init(this);
    onSuccess(conn);
  } else {
    onFailure(ar.cause());
  }
}
 
開發者ID:vietj,項目名稱:reactive-pg-client,代碼行數:12,代碼來源:PgPoolImpl.java

示例9: 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

示例10: handle

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
@Override
public void handle(AsyncResult<Connection> ar) {
  if (ar.succeeded()) {
    conn = ar.result();
  } else {
    acquireFailure = ar.cause();
  }
}
 
開發者ID:vietj,項目名稱:reactive-pg-client,代碼行數:9,代碼來源:SimpleHolder.java

示例11: onPublish

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
protected void onPublish(AsyncResult<Record> resultHandler) {

		if (resultHandler.succeeded()) {
			
			record = resultHandler.result();
			log.info("{} microservice registered on ServiceDiscovery", resultHandler.result().getName());
		} else {

			log.error("Fail to registry microservice, fall out of process", resultHandler.cause());
			System.exit(CommonExitCode.REGISTRY_SERVICE_DISCOVERY_ERROR);
		}
	}
 
開發者ID:pflima92,項目名稱:jspare-vertx-ms-blueprint,代碼行數:13,代碼來源:RestAPIVerticle.java

示例12: 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

示例13: handle

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
@Override
public void handle(AsyncResult<Boolean> res) {
  suspended = res.result();
  handler.handle(res.map(result));
}
 
開發者ID:vietj,項目名稱:reactive-pg-client,代碼行數:6,代碼來源:ExtendedQueryResultHandler.java


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