本文整理匯總了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;
}
示例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());
}
}
示例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()));
}
}
}
示例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());
}
}
示例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());
}
}
}
示例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());
}
示例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());
}
示例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());
}
}
示例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());
}
}
示例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
}
}
示例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());
}
}
示例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();
}
示例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()));
}
}
示例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();
}
}
示例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();
}