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

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

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

VertxOptions.getClusterManager介绍

[英]Get the cluster manager to be used when clustering.

If the cluster manager has been programmatically set here, then that will be used when clustering.

Otherwise Vert.x attempts to locate a cluster manager on the classpath.
[中]获取群集时要使用的群集管理器。
如果集群管理器是在这里以编程方式设置的,那么在集群时将使用它。
否则,垂直。x尝试在类路径上定位群集管理器。

代码示例

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

private ClusterManager getClusterManager(VertxOptions options) {
 ClusterManager mgr = options.getClusterManager();
 if (mgr == null) {
  String clusterManagerClassName = System.getProperty("vertx.cluster.managerClass");
  if (clusterManagerClassName != null) {
   // We allow specify a sys prop for the cluster manager factory which overrides ServiceLoader
   try {
    Class<?> clazz = Class.forName(clusterManagerClassName);
    mgr = (ClusterManager) clazz.newInstance();
   } catch (Exception e) {
    throw new IllegalStateException("Failed to instantiate " + clusterManagerClassName, e);
   }
  } else {
   mgr = ServiceHelper.loadFactoryOrNull(ClusterManager.class);
   if (mgr == null) {
    throw new IllegalStateException("No ClusterManagerFactory instances found on classpath");
   }
  }
 }
 return mgr;
}

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

/**
 * Copy constructor
 *
 * @param other The other {@code VertxOptions} to copy when creating this
 */
public VertxOptions(VertxOptions other) {
 this.eventLoopPoolSize = other.getEventLoopPoolSize();
 this.workerPoolSize = other.getWorkerPoolSize();
 this.blockedThreadCheckInterval = other.getBlockedThreadCheckInterval();
 this.maxEventLoopExecuteTime = other.getMaxEventLoopExecuteTime();
 this.maxWorkerExecuteTime = other.getMaxWorkerExecuteTime();
 this.internalBlockingPoolSize = other.getInternalBlockingPoolSize();
 this.clusterManager = other.getClusterManager();
 this.haEnabled = other.isHAEnabled();
 this.quorumSize = other.getQuorumSize();
 this.haGroup = other.getHAGroup();
 this.metricsOptions = other.getMetricsOptions() != null ? new MetricsOptions(other.getMetricsOptions()) : null;
 this.fileSystemOptions = other.getFileSystemOptions() != null ? new FileSystemOptions(other.getFileSystemOptions()) : null;
 this.warningExceptionTime = other.warningExceptionTime;
 this.eventBusOptions = new EventBusOptions(other.eventBusOptions);
 this.addressResolverOptions = other.addressResolverOptions != null ? new AddressResolverOptions() : null;
 this.maxEventLoopExecuteTimeUnit = other.maxEventLoopExecuteTimeUnit;
 this.maxWorkerExecuteTimeUnit = other.maxWorkerExecuteTimeUnit;
 this.warningExceptionTimeUnit = other.warningExceptionTimeUnit;
 this.blockedThreadCheckIntervalUnit = other.blockedThreadCheckIntervalUnit;
}

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

assertEquals("localhost", options.getClusterHost());
assertNull(options.getClusterPublicHost());
assertEquals(null, options.getClusterManager());
assertEquals(2000l * 1000000, options.getMaxEventLoopExecuteTime());
assertEquals(1l * 60 * 1000 * 1000000, options.getMaxWorkerExecuteTime());
assertEquals(blockedThreadCheckInterval, options.getBlockedThreadCheckInterval());
assertEquals(clusterHost, options.getClusterHost());
assertEquals(null, options.getClusterManager());
assertEquals(maxEventLoopExecuteTime, options.getMaxEventLoopExecuteTime());
assertEquals(maxWorkerExecuteTime, options.getMaxWorkerExecuteTime());

代码示例来源:origin: io.vertx/vertx-core

private ClusterManager getClusterManager(VertxOptions options) {
 ClusterManager mgr = options.getClusterManager();
 if (mgr == null) {
  String clusterManagerClassName = System.getProperty("vertx.cluster.managerClass");
  if (clusterManagerClassName != null) {
   // We allow specify a sys prop for the cluster manager factory which overrides ServiceLoader
   try {
    Class<?> clazz = Class.forName(clusterManagerClassName);
    mgr = (ClusterManager) clazz.newInstance();
   } catch (Exception e) {
    throw new IllegalStateException("Failed to instantiate " + clusterManagerClassName, e);
   }
  } else {
   mgr = ServiceHelper.loadFactoryOrNull(ClusterManager.class);
   if (mgr == null) {
    throw new IllegalStateException("No ClusterManagerFactory instances found on classpath");
   }
  }
 }
 return mgr;
}

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

assertNull(options.getClusterManager());
assertEquals(options, options.setClusterManager(mgr));
assertSame(mgr, options.getClusterManager());
assertFalse(options.isHAEnabled());
assertEquals(options, options.setHAEnabled(true));

代码示例来源:origin: io.vertx/vertx-core

/**
 * Copy constructor
 *
 * @param other The other {@code VertxOptions} to copy when creating this
 */
public VertxOptions(VertxOptions other) {
 this.eventLoopPoolSize = other.getEventLoopPoolSize();
 this.workerPoolSize = other.getWorkerPoolSize();
 this.blockedThreadCheckInterval = other.getBlockedThreadCheckInterval();
 this.maxEventLoopExecuteTime = other.getMaxEventLoopExecuteTime();
 this.maxWorkerExecuteTime = other.getMaxWorkerExecuteTime();
 this.internalBlockingPoolSize = other.getInternalBlockingPoolSize();
 this.clusterManager = other.getClusterManager();
 this.haEnabled = other.isHAEnabled();
 this.quorumSize = other.getQuorumSize();
 this.haGroup = other.getHAGroup();
 this.metricsOptions = other.getMetricsOptions() != null ? new MetricsOptions(other.getMetricsOptions()) : null;
 this.fileSystemOptions = other.getFileSystemOptions() != null ? new FileSystemOptions(other.getFileSystemOptions()) : null;
 this.warningExceptionTime = other.warningExceptionTime;
 this.eventBusOptions = new EventBusOptions(other.eventBusOptions);
 this.addressResolverOptions = other.addressResolverOptions != null ? new AddressResolverOptions() : null;
 this.maxEventLoopExecuteTimeUnit = other.maxEventLoopExecuteTimeUnit;
 this.maxWorkerExecuteTimeUnit = other.maxWorkerExecuteTimeUnit;
 this.warningExceptionTimeUnit = other.warningExceptionTimeUnit;
 this.blockedThreadCheckIntervalUnit = other.blockedThreadCheckIntervalUnit;
}

代码示例来源:origin: io.vertx/vertx-core

assertEquals("localhost", options.getClusterHost());
assertNull(options.getClusterPublicHost());
assertEquals(null, options.getClusterManager());
assertEquals(2000l * 1000000, options.getMaxEventLoopExecuteTime());
assertEquals(1l * 60 * 1000 * 1000000, options.getMaxWorkerExecuteTime());
assertEquals(blockedThreadCheckInterval, options.getBlockedThreadCheckInterval());
assertEquals(clusterHost, options.getClusterHost());
assertEquals(null, options.getClusterManager());
assertEquals(maxEventLoopExecuteTime, options.getMaxEventLoopExecuteTime());
assertEquals(maxWorkerExecuteTime, options.getMaxWorkerExecuteTime());

代码示例来源:origin: io.vertx/vertx-core

assertNull(options.getClusterManager());
assertEquals(options, options.setClusterManager(mgr));
assertSame(mgr, options.getClusterManager());
assertFalse(options.isHAEnabled());
assertEquals(options, options.setHAEnabled(true));

相关文章

VertxOptions类方法