use of io.vertx.core.DeploymentOptions in project java-chassis by ServiceComb.
the class HighwayClient method init.
public void init(Vertx vertx) throws Exception {
TcpClientConfig config = createTcpClientConfig();
DeploymentOptions deployOptions = VertxUtils.createClientDeployOptions(clientMgr, HighwayConfig.getClientThreadCount(), HighwayConfig.getClientConnectionPoolPerThread(), config);
VertxUtils.blockDeploy(vertx, TcpClientVerticle.class, deployOptions);
}
use of io.vertx.core.DeploymentOptions in project java-chassis by ServiceComb.
the class VertxRestTransport method init.
@Override
public boolean init() throws Exception {
// 部署transport server
DeploymentOptions options = new DeploymentOptions().setInstances(TransportConfig.getThreadCount());
setListenAddressWithoutSchema(TransportConfig.getAddress());
SimpleJsonObject json = new SimpleJsonObject();
json.put(ENDPOINT_KEY, getEndpoint());
options.setConfig(json);
return VertxUtils.blockDeploy(transportVertx, RestServerVerticle.class, options);
}
use of io.vertx.core.DeploymentOptions in project vert.x by eclipse.
the class ContextTest method testVerticleUseDifferentOrderedExecutor.
private void testVerticleUseDifferentOrderedExecutor(boolean worker) throws Exception {
waitFor(2);
CountDownLatch latch1 = new CountDownLatch(1);
CountDownLatch latch2 = new CountDownLatch(1);
vertx.deployVerticle(new AbstractVerticle() {
@Override
public void start() throws Exception {
vertx.executeBlocking(fut -> {
latch1.countDown();
try {
awaitLatch(latch2);
fut.complete();
} catch (InterruptedException e) {
fut.fail(e);
}
}, ar -> {
assertTrue(ar.succeeded());
complete();
});
}
}, new DeploymentOptions().setWorker(worker));
awaitLatch(latch1);
CountDownLatch latch3 = new CountDownLatch(1);
vertx.deployVerticle(new AbstractVerticle() {
@Override
public void start() throws Exception {
vertx.executeBlocking(fut -> {
latch3.countDown();
fut.complete();
}, ar -> {
assertTrue(ar.succeeded());
complete();
});
}
}, new DeploymentOptions().setWorker(worker));
awaitLatch(latch3);
latch2.countDown();
await();
}
use of io.vertx.core.DeploymentOptions in project vert.x by eclipse.
the class DNSTest method testUseInMultithreadedWorker.
@Test
public void testUseInMultithreadedWorker() throws Exception {
class MyVerticle extends AbstractVerticle {
@Override
public void start() {
assertIllegalStateException(() -> vertx.createDnsClient(1234, "localhost"));
testComplete();
}
}
MyVerticle verticle = new MyVerticle();
vertx.deployVerticle(verticle, new DeploymentOptions().setWorker(true).setMultiThreaded(true));
await();
}
use of io.vertx.core.DeploymentOptions in project vert.x by eclipse.
the class AbstractVerticleTest method testFieldsSet.
@Test
public void testFieldsSet() {
JsonObject config = new JsonObject().put("foo", "bar");
vertx.deployVerticle(verticle, new DeploymentOptions().setConfig(config), onSuccess(res -> {
assertEquals(res, verticle.getDeploymentID());
assertEquals(config, verticle.getConfig());
testComplete();
}));
await();
}
Aggregations