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


Java AsyncResult.succeeded方法代碼示例

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


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

示例1: handleRecordList

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
protected Future<Record> handleRecordList(String alias, AsyncResult<List<Record>> resultHandler){
	Future<Record> future = Future.future();
	
	if(resultHandler.succeeded()){

		// Simple LoadBalance with findAny on stream
		Optional<Record> client = resultHandler.result().stream()
				.filter(record -> RecordMetadata.of(record.getMetadata()).getName().equals(alias)).findAny();
		
		if(client.isPresent()) future.complete(client.get());
		else future.fail(new BusinessException(RECORD_NOT_FOUND_REASON));
	}else{
		future.fail(resultHandler.cause());
	}
	return future;
}
 
開發者ID:pflima92,項目名稱:jspare-vertx-ms-blueprint,代碼行數:17,代碼來源:LoadBalanceServiceImpl.java

示例2: resultOfAuthentication

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
private void resultOfAuthentication(final AsyncResult<HttpResponse<Buffer>> postReturn,
		final Future<AuthInfo> futureAuthinfo) {
	if (postReturn.succeeded()) {
		// Get session info
		final Buffer body = postReturn.result().body();
		final AuthInfo a = this.extractAuthInfoFromBody(body);
		if (a != null) {
			this.setCachedAuthInfo(a);
			futureAuthinfo.complete(a);
		} else {
			futureAuthinfo.fail("Authentication phase failed, please check log");
		}
	} else {
		futureAuthinfo.fail(postReturn.cause());
	}
}
 
開發者ID:Stwissel,項目名稱:vertx-sfdc-platformevents,代碼行數:17,代碼來源:SoapApi.java

示例3: 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()));
        }
    }
}
 
開發者ID:silentbalanceyh,項目名稱:vertx-zero,代碼行數:18,代碼來源:RpcRepdor.java

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

示例5: registryServer

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
/**
 * Registry the data into etcd
 *
 * @param handler
 * @param options
 */
private void registryServer(final AsyncResult<Void> handler,
                            final ServidorOptions options) {
    final Integer port = options.getPort();
    final AtomicInteger out = ZeroAtomic.RPC_START_LOGS.get(port);
    if (Values.ONE == out.getAndIncrement()) {
        if (handler.succeeded()) {
            LOGGER.info(Info.RPC_LISTEN, Net.getIPv4(), String.valueOf(options.getPort()));
            // Started to write data in etcd center.
            LOGGER.info(Info.ETCD_SUCCESS, this.registry.getConfig());
            // Status registry
            startRegistry(options);
        } else {
            LOGGER.info(Info.RPC_FAILURE, null == handler.cause() ? "None" : handler.cause().getMessage());
        }
    }
}
 
開發者ID:silentbalanceyh,項目名稱:vertx-zero,代碼行數:23,代碼來源:ZeroRpcAgent.java

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

示例7: onCreateCacheResponse

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
private void onCreateCacheResponse(AsyncResult<Void> ar) {
  if (ar.succeeded()) {
    future.complete(createResult);
    return;
  }

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

示例8: handle

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
@Override
public void handle(AsyncResult<T> ar) {
    if (ar.succeeded()) {
        complete(ar.result());
    } else {
        completeExceptionally(ar.cause());
    }
}
 
開發者ID:tibor-kocsis,項目名稱:vertx-graphql-utils,代碼行數:9,代碼來源:AsyncResCF.java

示例9: handleSimpleDbReply

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
private void handleSimpleDbReply(RoutingContext context, AsyncResult<Void> reply) {
  if (reply.succeeded()) {
    context.response().setStatusCode(200);
    context.response().putHeader("Content-Type", "application/json");
    context.response().end(new JsonObject().put("success", true).encode());
  } else {
    context.response().setStatusCode(500);
    context.response().putHeader("Content-Type", "application/json");
    context.response().end(new JsonObject()
      .put("success", false)
      .put("error", reply.cause().getMessage()).encode());
  }
}
 
開發者ID:vert-x3,項目名稱:vertx-guide-for-java-devs,代碼行數:14,代碼來源:HttpServerVerticle.java

示例10: notifyAuditResult

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

		if (resultHandler.succeeded()) {
			
			log.debug("Audit saved for TID [{}]", getTid());
		} else {
			log.error("Erro on save audit", resultHandler.cause());
			// TODO notify
		}
	}
 
開發者ID:pflima92,項目名稱:jspare-vertx-ms-blueprint,代碼行數:11,代碼來源:AuditFuture.java

示例11: completeStartup

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
private void completeStartup(AsyncResult<HttpServer> http, Future<Void> fut) {
    if (http.succeeded()) {
        initConfigs();

        LOG.info("SUCCESS: wayf-cloud successfully initialized");
        fut.complete();
    } else {
        LOG.debug("FAILURE: Could not start wayf-cloud due to exception", http.cause());
        fut.fail(http.cause());
    }
}
 
開發者ID:Atypon-OpenSource,項目名稱:wayf-cloud,代碼行數:12,代碼來源:WayfVerticle.java

示例12: afterBegin

import io.vertx.core.AsyncResult; //導入方法依賴的package包/類
private synchronized void afterBegin(AsyncResult<?> ar) {
  if (ar.succeeded()) {
    status = ST_PENDING;
  } else {
    status = ST_COMPLETED;
  }
  checkPending();
}
 
開發者ID:vietj,項目名稱:reactive-pg-client,代碼行數:9,代碼來源:Transaction.java

示例13: handle

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

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

示例15: setConfiguration

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

		if (resHandler.succeeded()) {
			log.debug("Received configurations {}", resHandler.result());
			context.config().mergeIn(resHandler.result());
		}

		log.debug("Using follow configurations {}", context.config().encodePrettily());
		initialize();
	}
 
開發者ID:pflima92,項目名稱:jspare-vertx-ms-blueprint,代碼行數:11,代碼來源:MicroserviceVerticle.java


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