use of io.vertx.core.Vertx in project vert.x by eclipse.
the class StreamsExamples method pump4.
public void pump4(Vertx vertx) {
NetServer server = vertx.createNetServer(new NetServerOptions().setPort(1234).setHost("localhost"));
server.connectHandler(sock -> {
sock.handler(buffer -> {
sock.write(buffer);
if (sock.writeQueueFull()) {
sock.pause();
sock.drainHandler(done -> {
sock.resume();
});
}
});
}).listen();
}
use of io.vertx.core.Vertx in project yyl_example by Relucent.
the class HelloVertxVerticle method main.
public static void main(String[] args) throws IOException {
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(HelloVertxVerticle.class.getName());
}
use of io.vertx.core.Vertx in project java-chassis by ServiceComb.
the class AbstractClientPool method create.
public void create() {
// 这里面是同步接口,且好像直接在事件线程中用,保险起见,先使用独立的vertx实例
Vertx vertx = VertxUtils.getOrCreateVertxByName("registry", null);
HttpClientOptions httpClientOptions = createHttpClientOptions();
DeploymentOptions deployOptions = VertxUtils.createClientDeployOptions(this.clientMgr, ServiceRegistryConfig.INSTANCE.getWorkerPoolSize(), 1, httpClientOptions);
try {
VertxUtils.blockDeploy(vertx, HttpClientVerticle.class, deployOptions);
} catch (InterruptedException e) {
LOGGER.error("deploy a registry verticle failed, {}", e.getMessage());
}
}
Aggregations