本文整理汇总了Java中io.vertx.rxjava.core.AbstractVerticle类的典型用法代码示例。如果您正苦于以下问题:Java AbstractVerticle类的具体用法?Java AbstractVerticle怎么用?Java AbstractVerticle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractVerticle类属于io.vertx.rxjava.core包,在下文中一共展示了AbstractVerticle类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDeploy
import io.vertx.rxjava.core.AbstractVerticle; //导入依赖的package包/类
@Test
public void testDeploy() throws Exception {
AtomicInteger count = new AtomicInteger();
vertx.deployVerticle(new AbstractVerticle() {
@Override
public void start() throws Exception {
HttpServer s1 = vertx.createHttpServer(new HttpServerOptions().setPort(8080)).requestHandler(req -> {
});
HttpServer s2 = vertx.createHttpServer(new HttpServerOptions().setPort(8081)).requestHandler(req -> {
});
Observable<HttpServer> f1 = s1.listenObservable();
Observable<HttpServer> f2 = s2.listenObservable();
Action1<HttpServer> done = server -> {
if (count.incrementAndGet() == 2) {
testComplete();
}
};
f1.subscribe(done);
f2.subscribe(done);
}
});
await();
}
示例2: testDeployVerticle
import io.vertx.rxjava.core.AbstractVerticle; //导入依赖的package包/类
@Test
public void testDeployVerticle() throws Exception {
CountDownLatch deployLatch = new CountDownLatch(2);
io.vertx.rxjava.core.RxHelper.deployVerticle(vertx, new AbstractVerticle() {
@Override
public void start() {
deployLatch.countDown();
}
}).subscribe(resp -> {
deployLatch.countDown();
});
awaitLatch(deployLatch);
}