本文整理了Java中io.vertx.ext.unit.Async.handler()
方法的一些代码示例,展示了Async.handler()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Async.handler()
方法的具体详情如下:
包路径:io.vertx.ext.unit.Async
类名称:Async
方法名:handler
暂无
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Completion handler to receive a completion signal when this completions completes.
* @param completionHandler the completion handler
*/
public void handler(Handler<AsyncResult<Void>> completionHandler) {
delegate.handler(completionHandler);
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Completion handler to receive a completion signal when this completions completes.
* @param completionHandler the completion handler
*/
public void handler(Handler<AsyncResult<Void>> completionHandler) {
delegate.handler(completionHandler);
}
代码示例来源:origin: io.vertx/vertx-kafka-client
done.handler(r -> wrappedConsumer.close());
wrappedConsumer.handler(handler -> {
代码示例来源:origin: vert-x3/vertx-kafka-client
done.handler(r -> wrappedConsumer.close());
wrappedConsumer.handler(handler -> {
代码示例来源:origin: io.vertx/vertx-kafka-client
AtomicInteger count = new AtomicInteger(numMessages);
Async batchHandler = ctx.async();
batchHandler.handler(ar -> wrappedConsumer.close());
wrappedConsumer.batchHandler(records -> {
ctx.assertEquals(numMessages, records.size());
代码示例来源:origin: vert-x3/vertx-kafka-client
AtomicInteger count = new AtomicInteger(numMessages);
Async batchHandler = ctx.async();
batchHandler.handler(ar -> wrappedConsumer.close());
wrappedConsumer.batchHandler(records -> {
ctx.assertEquals(numMessages, records.size());
代码示例来源:origin: io.vertx/vertx-consul-client
private void testSessionsBlocking(TestContext tc, BiConsumer<BlockingQueryOptions, Handler<AsyncResult<SessionList>>> request) {
ctx.writeClient().createSession(tc.asyncAssertSuccess(id1 -> {
ctx.readClient().listSessions(tc.asyncAssertSuccess(list1 -> {
Async async = tc.async();
request.accept(new BlockingQueryOptions().setIndex(list1.getIndex()), h -> {
List<String> ids = h.result().getList().stream().map(Session::getId).collect(Collectors.toList());
assertTrue(ids.contains(id1));
async.countDown();
});
vertx.setTimer(1000, l -> {
assertEquals(async.count(), 1);
ctx.writeClient().createSession(tc.asyncAssertSuccess(id2 -> {
async.handler(a -> {
ctx.writeClient().destroySession(id1, tc.asyncAssertSuccess(d1 -> {
ctx.writeClient().destroySession(id2, tc.asyncAssertSuccess());
}));
});
}));
});
}));
}));
}
代码示例来源:origin: io.vertx/vertx-consul-client
vertx.<ConsulAgent>executeBlocking(b1 -> b1.complete(ctx.attachAgent("attached_node")), tc.asyncAssertSuccess(attached -> {
System.out.println(">>>>>>> new node attached");
async1.handler(v -> {
ctx.readClient().catalogNodes(tc.asyncAssertSuccess(nodes2 -> {
NodeQueryOptions blockingQueryOptions2 = new NodeQueryOptions()
代码示例来源:origin: io.vertx/vertx-consul-client
async.countDown();
}));
async.handler(v -> {
ctx.writeClient().deregisterService(serviceId, tc.asyncAssertSuccess(deregistered -> {
ctx.writeClient().localServices(tc.asyncAssertSuccess(cleaned -> {
代码示例来源:origin: io.vertx/vertx-consul-client
private void blockingQuery(TestContext tc, BiConsumer<String, Handler<Long>> indexSupplier) {
String key = randomFooBarAlpha();
String value = randomAlphaString(10);
ctx.writeClient()
.putValue(key, randomAlphaString(10), tc.asyncAssertSuccess(b1 -> {
tc.assertTrue(b1);
indexSupplier.accept(key, consulIndex -> {
Async async = tc.async(2);
vertx.setTimer(TimeUnit.SECONDS.toMillis(2), l -> {
ctx.writeClient().putValue(key, value, tc.asyncAssertSuccess(b2 -> {
tc.assertTrue(b2);
ctx.readClient().getValueWithOptions(key, new BlockingQueryOptions().setIndex(consulIndex), tc.asyncAssertSuccess(kv -> {
tc.assertTrue(kv.getModifyIndex() > consulIndex);
tc.assertEquals(kv.getValue(), value);
async.countDown();
}));
ctx.readClient().getValuesWithOptions("foo/bar", new BlockingQueryOptions().setIndex(consulIndex), tc.asyncAssertSuccess(kv -> {
tc.assertTrue(kv.getIndex() > consulIndex);
tc.assertTrue(kv.getList().size() == 1);
async.countDown();
}));
}));
});
async.handler(v -> ctx.writeClient().deleteValue(key, tc.asyncAssertSuccess()));
});
}));
}
}
内容来源于网络,如有侵权,请联系作者删除!