io.vertx.core.VertxOptions.isClustered()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(169)

本文整理了Java中io.vertx.core.VertxOptions.isClustered()方法的一些代码示例,展示了VertxOptions.isClustered()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VertxOptions.isClustered()方法的具体详情如下:
包路径:io.vertx.core.VertxOptions
类名称:VertxOptions
方法名:isClustered

VertxOptions.isClustered介绍

[英]Is the Vert.x instance clustered?
[中]是垂直的。x实例集群?

代码示例

代码示例来源:origin: eclipse-vertx/vert.x

/**
 * @return whether the {@code cluster} option or the {@code ha} option are enabled. Also {@code true} when a custom
 * launcher modifies the Vert.x options to set `clustered` to {@code true}
 */
@Override
public boolean isClustered() {
 return cluster || ha || (options != null  && options.isClustered());
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
public Vertx vertx(VertxOptions options) {
 if (options.isClustered()) {
  throw new IllegalArgumentException("Please use Vertx.clusteredVertx() to create a clustered Vert.x instance");
 }
 return VertxImpl.vertx(options);
}

代码示例来源:origin: vert-x3/vertx-examples

if (options.isClustered()) {
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {

代码示例来源:origin: vert-x3/vertx-examples

if (options.isClustered()) {
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {

代码示例来源:origin: vert-x3/vertx-examples

if (options.isClustered()) {
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {

代码示例来源:origin: vert-x3/vertx-examples

if (options.isClustered()) {
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {

代码示例来源:origin: vert-x3/vertx-examples

if (options.isClustered()) {
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {

代码示例来源:origin: vert-x3/vertx-examples

if (options.isClustered()) {
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {

代码示例来源:origin: vert-x3/vertx-examples

if (options.isClustered()) {
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {

代码示例来源:origin: vert-x3/vertx-examples

if (options.isClustered()) {
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {

代码示例来源:origin: vert-x3/vertx-examples

if (options.isClustered()) {
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {

代码示例来源:origin: vert-x3/vertx-examples

if (options.isClustered()) {
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {

代码示例来源:origin: vert-x3/vertx-examples

if (options.isClustered()) {
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {

代码示例来源:origin: vert-x3/vertx-examples

if (options.isClustered()) {
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {

代码示例来源:origin: vert-x3/vertx-examples

if (options.isClustered()) {
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {

代码示例来源:origin: eclipse-vertx/vert.x

json.put("clustered", obj.isClustered());
if (obj.getEventBusOptions() != null) {
 json.put("eventBusOptions", obj.getEventBusOptions().toJson());

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testCreateClusteredVertxAsyncDontSetClustered() {
 VertxOptions options = new VertxOptions();
 clusteredVertx(options, ar -> {
  assertTrue(ar.succeeded());
  assertNotNull(ar.result());
  assertTrue(options.isClustered());
  assertTrue(ar.result().isClustered());
  Vertx v = ar.result();
  v.close(ar2 -> {
   assertTrue(ar2.succeeded());
   testComplete();
  });
 });
 await();
}

代码示例来源:origin: eclipse-vertx/vert.x

private void testConfigureFromJson(boolean jsonFile) throws Exception {
 JsonObject json = new JsonObject()
  .put("eventLoopPoolSize", 123)
  .put("maxEventLoopExecuteTime", 123767667)
  .put("metricsOptions", new JsonObject().put("enabled", true))
  .put("eventBusOptions", new JsonObject().put("clustered", true).put("clusterPublicHost", "mars"))
  .put("haGroup", "somegroup")
  .put("maxEventLoopExecuteTimeUnit", "SECONDS");
 String optionsArg;
 if (jsonFile) {
  File file = testFolder.newFile();
  Files.write(file.toPath(), json.toBuffer().getBytes());
  optionsArg = file.getPath();
 } else {
  optionsArg = json.toString();
 }
 MyLauncher launcher = new MyLauncher();
 String[] args = new String[]{"run", "java:" + TestVerticle.class.getCanonicalName(), "-options", optionsArg};
 launcher.dispatch(args);
 assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1);
 VertxOptions opts = launcher.getVertxOptions();
 assertEquals(123, opts.getEventLoopPoolSize(), 0);
 assertEquals(123767667L, opts.getMaxEventLoopExecuteTime());
 assertEquals(true, opts.getMetricsOptions().isEnabled());
 assertEquals(true, opts.isClustered());
 assertEquals("mars", opts.getClusterPublicHost());
 assertEquals("somegroup", opts.getHAGroup());
 assertEquals(TimeUnit.SECONDS, opts.getMaxEventLoopExecuteTimeUnit());
}

代码示例来源:origin: eclipse-vertx/vert.x

this.addressResolver = new AddressResolver(this, options.getAddressResolverOptions());
this.deploymentManager = new DeploymentManager(this);
if (options.isClustered()) {
 this.clusterManager = getClusterManager(options);
 this.eventBus = new ClusteredEventBus(this, options, clusterManager);

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testDefaultJsonOptions() {
 VertxOptions def = new VertxOptions();
 VertxOptions json = new VertxOptions(new JsonObject());
 assertEquals(def.getEventLoopPoolSize(), json.getEventLoopPoolSize());
 assertEquals(def.getWorkerPoolSize(), json.getWorkerPoolSize());
 assertEquals(def.isClustered(), json.isClustered());
 assertEquals(def.getClusterHost(), json.getClusterHost());
 assertEquals(def.getClusterPublicHost(), json.getClusterPublicHost());
 assertEquals(def.getClusterPublicPort(), json.getClusterPublicPort());
 assertEquals(def.getClusterPingInterval(), json.getClusterPingInterval());
 assertEquals(def.getClusterPingReplyInterval(), json.getClusterPingReplyInterval());
 assertEquals(def.getBlockedThreadCheckInterval(), json.getBlockedThreadCheckInterval());
 assertEquals(def.getMaxEventLoopExecuteTime(), json.getMaxEventLoopExecuteTime());
 assertEquals(def.getMaxWorkerExecuteTime(), json.getMaxWorkerExecuteTime());
 assertEquals(def.getInternalBlockingPoolSize(), json.getInternalBlockingPoolSize());
 assertEquals(def.isHAEnabled(), json.isHAEnabled());
 assertEquals(def.getQuorumSize(), json.getQuorumSize());
 assertEquals(def.getHAGroup(), json.getHAGroup());
 assertEquals(def.getWarningExceptionTime(), json.getWarningExceptionTime());
 assertEquals(def.isFileResolverCachingEnabled(), json.isFileResolverCachingEnabled());
 assertEquals(def.getMaxEventLoopExecuteTimeUnit(), json.getMaxEventLoopExecuteTimeUnit());
 assertEquals(def.getMaxWorkerExecuteTimeUnit(), json.getMaxWorkerExecuteTimeUnit());
 assertEquals(def.getWarningExceptionTimeUnit(), json.getWarningExceptionTimeUnit());
 assertEquals(def.getBlockedThreadCheckIntervalUnit(), json.getBlockedThreadCheckIntervalUnit());
}

相关文章

VertxOptions类方法