当前位置: 首页>>代码示例>>Java>>正文


Java VertxOptions类代码示例

本文整理汇总了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);
}
 
开发者ID:folio-org,项目名称:okapi,代码行数:19,代码来源:DropwizardHelper.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:18,代码来源:VertxImplEx.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:23,代码来源:TestVertxRestTransport.java

示例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());
            }
        });
    }
 
开发者ID:gmuecke,项目名称:grafana-vertx-datasource,代码行数:21,代码来源:BitcoinAdjustedData.java

示例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());
            }
        });
    }
 
开发者ID:gmuecke,项目名称:grafana-vertx-datasource,代码行数:25,代码来源:JSPercentilesDatasource.java

示例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());
            }
        });
    }
 
开发者ID:gmuecke,项目名称:grafana-vertx-datasource,代码行数:21,代码来源:JSAggregateDatasource.java

示例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());
            }
        });

    }
 
开发者ID:gmuecke,项目名称:grafana-vertx-datasource,代码行数:18,代码来源:DistributedDatasource.java

示例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);
}
 
开发者ID:glytching,项目名称:dragoman,代码行数:21,代码来源:DragomanModule.java

示例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);
						});
			});
}
 
开发者ID:FroMage,项目名称:redpipe,代码行数:24,代码来源:Server.java

示例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));
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:17,代码来源:VertxVisitor.java

示例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);
}
 
开发者ID:ARMmbed,项目名称:mbed-cloud-sdk-java,代码行数:23,代码来源:TestServer.java

示例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);
}
 
开发者ID:codefacts,项目名称:Elastic-Components,代码行数:26,代码来源:Insert22.java

示例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);
    }
 
开发者ID:openmg,项目名称:vertx-gremlin,代码行数:18,代码来源:VertxGremlinServerTest.java

示例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());
  }
}
 
开发者ID:vert-x3,项目名称:vertx-infinispan,代码行数:20,代码来源:InfinispanHATest.java

示例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");

    });

}
 
开发者ID:mcollovati,项目名称:vaadin-vertx-samples,代码行数:20,代码来源:SessionStoreAdapterUT.java


注:本文中的io.vertx.core.VertxOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。