use of io.vertx.core.VertxOptions in project vert.x by eclipse.
the class HostnameResolutionTest method testSearchDomainWithNdots2.
@Test
public void testSearchDomainWithNdots2() throws Exception {
Map<String, String> records = new HashMap<>();
records.put("host1.sub.foo.com", "127.0.0.1");
records.put("host2.sub.foo.com", "127.0.0.2");
records.put("host2.sub", "127.0.0.3");
dnsServer.stop();
dnsServer = FakeDNSServer.testResolveA(records);
dnsServer.start();
VertxInternal vertx = (VertxInternal) vertx(new VertxOptions().setAddressResolverOptions(new AddressResolverOptions().addServer(dnsServerAddress.getAddress().getHostAddress() + ":" + dnsServerAddress.getPort()).setOptResourceEnabled(false).addSearchDomain("foo.com").setNdots(2)));
CountDownLatch latch1 = new CountDownLatch(1);
vertx.resolveAddress("host1.sub", onSuccess(resolved -> {
assertEquals("127.0.0.1", resolved.getHostAddress());
latch1.countDown();
}));
awaitLatch(latch1);
// "host2.sub" is resolved with the foo.com search domain as ndots = 2
CountDownLatch latch2 = new CountDownLatch(1);
vertx.resolveAddress("host2.sub", onSuccess(resolved -> {
assertEquals("127.0.0.2", resolved.getHostAddress());
latch2.countDown();
}));
awaitLatch(latch2);
}
use of io.vertx.core.VertxOptions in project java-chassis by ServiceComb.
the class VertxUtils method init.
public static Vertx init(VertxOptions vertxOptions) {
if (vertxOptions == null) {
vertxOptions = new VertxOptions();
}
boolean isDebug = ManagementFactory.getRuntimeMXBean().getInputArguments().toString().indexOf("jdwp") >= 0;
if (isDebug) {
vertxOptions.setBlockedThreadCheckInterval(BLOCKED_THREAD_CHECK_INTERVAL);
LOGGER.info("in debug mode, disable blocked thread check.");
}
configureVertxFileCaching();
return Vertx.vertx(vertxOptions);
}
use of io.vertx.core.VertxOptions in project java-chassis by ServiceComb.
the class TestVertex method testVertxUtils.
@Test
public void testVertxUtils() {
VertxUtils.init(null);
VertxOptions oOptions = new VertxOptions();
oOptions.setClustered(false);
Assert.assertNotEquals(null, VertxUtils.init(oOptions));
}
use of io.vertx.core.VertxOptions in project Summer by yale8848.
the class TestMain method main.
public static void main(String[] args) {
VertxOptions options = new VertxOptions();
options.setBlockedThreadCheckInterval(20000);
options.setMaxEventLoopExecuteTime(20000);
SummerServer summerServer = SummerServer.create("localhost", 8080, options);
DeploymentOptions deploymentOptions = new DeploymentOptions();
summerServer.getVertx().deployVerticle(MyVerticle.class.getName());
deploymentOptions.setWorker(true);
summerServer.getSummerRouter().registerResource(Hello.class);
summerServer.getVertx().deployVerticle(SummerServer.WebServer.class.getName());
summerServer.start();
}
Aggregations