本文整理汇总了Java中io.vertx.core.VertxOptions类的典型用法代码示例。如果您正苦于以下问题:Java VertxOptions类的具体用法?Java VertxOptions怎么用?Java VertxOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VertxOptions类属于io.vertx.core包,在下文中一共展示了VertxOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: config
import io.vertx.core.VertxOptions; //导入依赖的package包/类
public static void config(String graphiteHost, int port, TimeUnit tu,
int period, VertxOptions vopt, String hostName) {
final String registryName = "okapi";
MetricRegistry registry = SharedMetricRegistries.getOrCreate(registryName);
DropwizardMetricsOptions metricsOpt = new DropwizardMetricsOptions();
metricsOpt.setEnabled(true).setRegistryName(registryName);
vopt.setMetricsOptions(metricsOpt);
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, port));
final String prefix = "folio.okapi." + hostName ;
GraphiteReporter reporter = GraphiteReporter.forRegistry(registry)
.prefixedWith(prefix)
.build(graphite);
reporter.start(period, tu);
logger.info("Metrics remote:" + graphiteHost + ":"
+ port + " this:" + prefix);
}
示例2: VertxImplEx
import io.vertx.core.VertxOptions; //导入依赖的package包/类
public VertxImplEx(String name, VertxOptions vertxOptions) {
super(vertxOptions);
if (StringUtils.isEmpty(name)) {
return;
}
Field field = ReflectionUtils.findField(VertxImpl.class, "eventLoopThreadFactory");
field.setAccessible(true);
VertxThreadFactory eventLoopThreadFactory = (VertxThreadFactory) ReflectionUtils.getField(field, this);
field = ReflectionUtils.findField(eventLoopThreadFactory.getClass(), "prefix");
field.setAccessible(true);
String prefix = (String) ReflectionUtils.getField(field, eventLoopThreadFactory);
ReflectionUtils.setField(field, eventLoopThreadFactory, name + "-" + prefix);
}
示例3: testInit
import io.vertx.core.VertxOptions; //导入依赖的package包/类
@Test
public void testInit() {
boolean status = false;
try {
new MockUp<VertxUtils>() {
@Mock
public Vertx init(VertxOptions vertxOptions) {
return null;
}
@Mock
public <VERTICLE extends AbstractVerticle> boolean blockDeploy(Vertx vertx, Class<VERTICLE> cls,
DeploymentOptions options) throws InterruptedException {
return true;
}
};
instance.init();
} catch (Exception e) {
status = true;
}
Assert.assertFalse(status);
}
示例4: main
import io.vertx.core.VertxOptions; //导入依赖的package包/类
public static void main(String... args) {
//Note to self
// run this demo in HA mode, deploy this verticle on a separate node and combine it with demo6
final JsonObject config = Config.fromFile("config/demo7.json");
VertxOptions opts = new VertxOptions().setClustered(true);
Vertx.clusteredVertx(opts, result -> {
if (result.succeeded()) {
LOG.info("Cluster running");
Vertx vertx = result.result();
vertx.deployVerticle(BitcoinAdjustedData.class.getName(),
new DeploymentOptions().setConfig(config).setWorker(false));
} else {
LOG.error("Clusterin failed");
throw new RuntimeException(result.cause());
}
});
}
示例5: main
import io.vertx.core.VertxOptions; //导入依赖的package包/类
public static void main(String... args) {
final JsonObject config = Config.fromFile("config/demo6.json");
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(new JSPercentilesDatasource(), new DeploymentOptions().setConfig(config));
/*
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(new JSAggregateDatasource(), new DeploymentOptions().setConfig(config));
*/
VertxOptions opts = new VertxOptions().setClustered(true);
Vertx.clusteredVertx(opts, result -> {
if(result.succeeded()){
LOG.info("Cluster running");
Vertx cvertx = result.result();
cvertx.deployVerticle(new JSPercentilesDatasource(), new DeploymentOptions().setConfig(config));
} else {
LOG.error("Clustering failed");
throw new RuntimeException(result.cause());
}
});
}
示例6: main
import io.vertx.core.VertxOptions; //导入依赖的package包/类
public static void main(String... args) {
final JsonObject config = Config.fromFile("config/demo6.json");
/*
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(new JSAggregateDatasource(), new DeploymentOptions().setConfig(config));
*/
VertxOptions opts = new VertxOptions().setClustered(true);
Vertx.clusteredVertx(opts, result -> {
if(result.succeeded()){
LOG.info("Cluster running");
Vertx vertx = result.result();
vertx.deployVerticle(new JSAggregateDatasource(), new DeploymentOptions().setConfig(config));
} else {
LOG.error("Clustering failed");
throw new RuntimeException(result.cause());
}
});
}
示例7: main
import io.vertx.core.VertxOptions; //导入依赖的package包/类
public static void main(String... args) {
VertxOptions options = new VertxOptions().setClustered(true)
.setHAEnabled(true)
.setHAGroup("dev");
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
deployVerticles(vertx);
LOG.info("Vertx Cluster running");
} else {
LOG.error("Creating Vertx cluster failed", res.cause());
}
});
}
示例8: provideVertx
import io.vertx.core.VertxOptions; //导入依赖的package包/类
@Provides
@Singleton
public Vertx provideVertx(ApplicationConfiguration applicationConfiguration) {
VertxOptions vertxOptions =
new VertxOptions()
.setMaxEventLoopExecuteTime(applicationConfiguration.getMaxEventLoopExecutionTime())
.setWarningExceptionTime(20L * 1000 * 1000000)
.setMaxWorkerExecuteTime(applicationConfiguration.getMaxWorkerExecutionTime())
.setWorkerPoolSize(applicationConfiguration.getWorkerPoolSize());
// see
// https://github.com/vert-x3/vertx-dropwizard-metrics/blob/master/src/main/asciidoc/java/index.adoc#jmx
vertxOptions.setMetricsOptions(
new DropwizardMetricsOptions()
.setEnabled(applicationConfiguration.isMetricsEnabled())
.setJmxEnabled(applicationConfiguration.isJmxEnabled())
.setJmxDomain(applicationConfiguration.getJmxDomainName()));
return Vertx.vertx(vertxOptions);
}
示例9: start
import io.vertx.core.VertxOptions; //导入依赖的package包/类
public Single<Void> start(JsonObject defaultConfig, Class<?>... resourceOrProviderClasses){
setupLogging();
VertxOptions options = new VertxOptions();
options.setWarningExceptionTime(Long.MAX_VALUE);
vertx = Vertx.vertx(options);
AppGlobals.init();
AppGlobals.get().setVertx(vertx);
// Propagate the Resteasy context on RxJava
RxJavaHooks.setOnSingleCreate(new ResteasyContextPropagatingOnSingleCreateAction());
return loadConfig(defaultConfig)
.flatMap(config -> {
return setupPlugins()
.flatMap(v -> setupTemplateRenderers())
.flatMap(v -> setupResteasy(resourceOrProviderClasses))
.flatMap(deployment -> {
setupSwagger(deployment);
return setupVertx(config, deployment);
});
});
}
示例10: visit
import io.vertx.core.VertxOptions; //导入依赖的package包/类
@Override
public ConcurrentMap<String, VertxOptions> visit(final String... keys)
throws ZeroException {
// 1. Must be the first line, fixed position.
Ensurer.eqLength(getClass(), 0, (Object[]) keys);
// 2. Visit the node for vertx
final JsonObject data = this.NODE.read();
// 3. Vertx node validation.
final JsonObject vertxData = data.getJsonObject(KEY);
LOGGER.info(Info.INF_B_VERIFY, KEY, getClass().getSimpleName(), vertxData);
Fn.shuntZero(() -> Ruler.verify(KEY, vertxData), vertxData);
// 4. Set cluster options
this.clusterOptions = this.clusterTransformer.transform(data.getJsonObject(YKEY_CLUSTERED));
// 5. Transfer Data
return visit(vertxData.getJsonArray(YKEY_INSTANCE));
}
示例11: start
import io.vertx.core.VertxOptions; //导入依赖的package包/类
public void start() {
sdk = null;
config = null;
if (server == null) {
Vertx vertx = Vertx
.vertx(new VertxOptions().setWorkerPoolSize(40).setBlockedThreadCheckInterval(1000L * 60L * 10L)
.setMaxWorkerExecuteTime(1000L * 1000L * 1000L * 60L * 10L));
HttpServerOptions options = new HttpServerOptions();
options.setMaxInitialLineLength(HttpServerOptions.DEFAULT_MAX_INITIAL_LINE_LENGTH * 2);
server = vertx.createHttpServer(options);
router = Router.router(vertx);
}
retrieveConfig();
if (config == null || config.isApiKeyEmpty()) {
logError("Unable to find " + String.valueOf(ENVVAR_MBED_CLOUD_API_KEY) + " environment variable");
System.exit(1);
}
defineInitialisationRoute();
defineModuleMethodTestRoute();
logInfo("Starting Java SDK test server on port " + String.valueOf(port) + "...");
server.requestHandler(router::accept).listen(port);
}
示例12: main
import io.vertx.core.VertxOptions; //导入依赖的package包/类
static void main(String[] asdfasd) {
JDBCClient jdbcClient = Test.jdbcClient("jpadb", Vertx.vertx(new VertxOptions()
.setWorkerPoolSize(1)
.setEventLoopPoolSize(1)
));
BaseOrm baseOrm = Test.baseOrm();
final JsonObject employee = new JsonObject(
"{\"eid\":1201,\"ename\":\"Gopal\",\"salary\":40000.0,\"deg\":\"Technical Manager\",\"department\":{\"id\":98798079087,\"name\":\"ICT\",\"department\":{\"id\":98457984,\"name\":\"RGV\",\"department\":{\"id\":94504975049,\"name\":\"MCE\",\"department\":null,\"employee\":{\"eid\":5258,\"ename\":\"Russel\",\"salary\":52000.0,\"deg\":\"ENG\",\"department\":null,\"department2\":null,\"departments\":[{\"id\":6538921,\"name\":\"TTSK\",\"department\":{\"id\":267935328,\"name\":\"VTVG\",\"department\":null,\"employee\":null},\"employee\":null}]}},\"employee\":{\"eid\":5258,\"ename\":\"Russel\",\"salary\":52000.0,\"deg\":\"ENG\",\"department\":null,\"department2\":null,\"departments\":[{\"id\":6538921,\"name\":\"TTSK\",\"department\":{\"id\":267935328,\"name\":\"VTVG\",\"department\":null,\"employee\":null},\"employee\":null}]}},\"employee\":{\"eid\":5258,\"ename\":\"Russel\",\"salary\":52000.0,\"deg\":\"ENG\",\"department\":null,\"department2\":null,\"departments\":[{\"id\":6538921,\"name\":\"TTSK\",\"department\":{\"id\":267935328,\"name\":\"VTVG\",\"department\":null,\"employee\":null},\"employee\":null}]}},\"department2\":{\"id\":988286326887,\"name\":\"BGGV\",\"department\":{\"id\":8283175518,\"name\":\"MKLC\",\"department\":{\"id\":56165582,\"name\":\"VVKM\",\"department\":null,\"employee\":{\"eid\":2389,\"ename\":\"KOMOL\",\"salary\":8000.0,\"deg\":\"DOC\",\"department\":null,\"department2\":null,\"departments\":[]}},\"employee\":{\"eid\":5258,\"ename\":\"Russel\",\"salary\":52000.0,\"deg\":\"ENG\",\"department\":null,\"department2\":null,\"departments\":[{\"id\":6538921,\"name\":\"TTSK\",\"department\":{\"id\":267935328,\"name\":\"VTVG\",\"department\":null,\"employee\":null},\"employee\":null}]}},\"employee\":{\"eid\":5258,\"ename\":\"Russel\",\"salary\":52000.0,\"deg\":\"ENG\",\"department\":null,\"department2\":null,\"departments\":[{\"id\":6538921,\"name\":\"TTSK\",\"department\":{\"id\":267935328,\"name\":\"VTVG\",\"department\":null,\"employee\":null},\"employee\":null}]}},\"departments\":[{\"id\":98798079087,\"name\":\"ICT\",\"department\":{\"id\":98457984,\"name\":\"RGV\",\"department\":{\"id\":94504975049,\"name\":\"MCE\",\"department\":null,\"employee\":{\"eid\":5258,\"ename\":\"Russel\",\"salary\":52000.0,\"deg\":\"ENG\",\"department\":null,\"department2\":null,\"departments\":[{\"id\":6538921,\"name\":\"TTSK\",\"department\":{\"id\":267935328,\"name\":\"VTVG\",\"department\":null,\"employee\":null},\"employee\":null}]}},\"employee\":{\"eid\":5258,\"ename\":\"Russel\",\"salary\":52000.0,\"deg\":\"ENG\",\"department\":null,\"department2\":null,\"departments\":[{\"id\":6538921,\"name\":\"TTSK\",\"department\":{\"id\":267935328,\"name\":\"VTVG\",\"department\":null,\"employee\":null},\"employee\":null}]}},\"employee\":{\"eid\":5258,\"ename\":\"Russel\",\"salary\":52000.0,\"deg\":\"ENG\",\"department\":null,\"department2\":null,\"departments\":[{\"id\":6538921,\"name\":\"TTSK\",\"department\":{\"id\":267935328,\"name\":\"VTVG\",\"department\":null,\"employee\":null},\"employee\":null}]}}]}"
);
merge(employee);
System.out.println(employee.encodePrettily());
baseOrm.upsert(
BaseOrm.UpsertParams.builder()
.entity("employee")
.jsonObject(employee)
.build()
).mapP(Test.sqlDB()::update).then(jsonObject -> {
System.out.println("ppp888888888888888888888888888888888888888888888888888888888888888888888");
}).err(Throwable::printStackTrace);
}
示例13: name
import io.vertx.core.VertxOptions; //导入依赖的package包/类
@Test
public void name() throws Exception {
JsonObject config = new JsonObject()
.put("gremlinServerConfigPath", "gremlin-server.yaml")
// .put("gremlinServerConfigPath", "D:\\tg-metagraph-reposities\\vertx-gremlin\\vertx-gremlin-server\\src\\test\\resources\\gremlin-server.yaml")
.put("eventBusAddress", "outMessage");
DeploymentOptions options = new DeploymentOptions().setConfig(config);
VertxOptions vertxOptions = new VertxOptions().setClustered(true);
Vertx.clusteredVertx(vertxOptions, event -> {
if (event.succeeded()) {
Vertx vertx = event.result();
vertx.deployVerticle(new VertxGremlinServer(), options);
}
});
Thread.sleep(Long.MAX_VALUE);
}
示例14: clusteredVertx
import io.vertx.core.VertxOptions; //导入依赖的package包/类
@Override
protected void clusteredVertx(VertxOptions options, Handler<AsyncResult<Vertx>> ar) {
CountDownLatch latch = new CountDownLatch(1);
Future<Vertx> future = Future.future();
future.setHandler(ar);
super.clusteredVertx(options, asyncResult -> {
if (asyncResult.succeeded()) {
future.complete(asyncResult.result());
} else {
future.fail(asyncResult.cause());
}
latch.countDown();
});
try {
assertTrue(latch.await(2, TimeUnit.MINUTES));
} catch (InterruptedException e) {
fail(e.getMessage());
}
}
示例15: shouldFireSessionExpiredEventForHazelcastSessionStore
import io.vertx.core.VertxOptions; //导入依赖的package包/类
@Test(timeout = 15000L)
public void shouldFireSessionExpiredEventForHazelcastSessionStore(TestContext context) {
Async async = context.async();
Vertx.clusteredVertx(new VertxOptions().setClusterManager(new HazelcastClusterManager()), res -> {
vertx = res.result();
SessionStore adapted = SessionStoreAdapter.adapt(vertx, ClusteredSessionStore.create(vertx));
Session session = adapted.createSession(2000);
sessionExpiredConsumer = SessionStoreAdapter.sessionExpiredHandler(vertx, event -> {
context.assertEquals(session.id(), event.body());
async.countDown();
});
adapted.put(session, Future.<Boolean>future().completer());
session.put("a", "b");
});
}