本文整理了Java中io.vertx.core.VertxOptions.setHAEnabled()
方法的一些代码示例,展示了VertxOptions.setHAEnabled()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VertxOptions.setHAEnabled()
方法的具体详情如下:
包路径:io.vertx.core.VertxOptions
类名称:VertxOptions
方法名:setHAEnabled
[英]Set whether HA will be enabled on the Vert.x instance.
[中]设置是否在Vert上启用HA。例如。
代码示例来源:origin: eclipse-vertx/vert.x
case "haEnabled":
if (member.getValue() instanceof Boolean) {
obj.setHAEnabled((Boolean)member.getValue());
代码示例来源:origin: eclipse-vertx/vert.x
protected void createNodes(int nodes) {
startNodes(nodes, new VertxOptions().setHAEnabled(true));
aliveNodes = new CopyOnWriteArrayList<>();
for (int i = 0; i < nodes; i++) {
aliveNodes.add(i);
int pos = i;
((VertxInternal)vertices[i]).failoverCompleteHandler((nodeID, haInfo, succeeded) -> {
failedOverOnto(pos);
});
}
deploymentSnapshots = new Set[nodes];
}
代码示例来源:origin: eclipse-vertx/vert.x
String haGroup = args.map.get("-hagroup");
int quorumSize = args.getInt("-quorum");
options.setHAEnabled(true);
if (haGroup != null) {
options.setHAGroup(haGroup);
代码示例来源:origin: eclipse-vertx/vert.x
protected Vertx startVertx(String haGroup, int quorumSize, boolean ha) throws Exception {
VertxOptions options = new VertxOptions().setHAEnabled(ha).setClustered(true).
setClusterHost("localhost").setClusterManager(getClusterManager());
if (ha) {
options.setQuorumSize(quorumSize);
if (haGroup != null) {
options.setHAGroup(haGroup);
}
}
CountDownLatch latch = new CountDownLatch(1);
AtomicReference<Vertx> vertxRef = new AtomicReference<>();
clusteredVertx(options, onSuccess(vertx -> {
vertxRef.set(vertx);
latch.countDown();
}));
latch.await(2, TimeUnit.MINUTES);
return vertxRef.get();
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testSimpleFailover() throws Exception {
startNodes(2, new VertxOptions().setHAEnabled(true));
DeploymentOptions options = new DeploymentOptions().setHa(true);
JsonObject config = new JsonObject().put("foo", "bar");
options.setConfig(config);
CountDownLatch latch = new CountDownLatch(1);
vertices[0].deployVerticle("java:" + HAVerticle1.class.getName(), options, ar -> {
assertTrue(ar.succeeded());
assertEquals(1, vertices[0].deploymentIDs().size());
assertEquals(0, vertices[1].deploymentIDs().size());
latch.countDown();
});
awaitLatch(latch);
kill(0);
assertWaitUntil(() -> vertices[1].deploymentIDs().size() == 1);
checkDeploymentExists(1, "java:" + HAVerticle1.class.getName(), options);
}
代码示例来源:origin: eclipse-vertx/vert.x
options.setHAEnabled(true);
if (haGroup != null) {
options.setHAGroup(haGroup);
代码示例来源:origin: io.vertx/vertx-core
case "haEnabled":
if (member.getValue() instanceof Boolean) {
obj.setHAEnabled((Boolean)member.getValue());
代码示例来源:origin: io.vertx/vertx-core
protected void createNodes(int nodes) {
startNodes(nodes, new VertxOptions().setHAEnabled(true));
aliveNodes = new CopyOnWriteArrayList<>();
for (int i = 0; i < nodes; i++) {
aliveNodes.add(i);
int pos = i;
((VertxInternal)vertices[i]).failoverCompleteHandler((nodeID, haInfo, succeeded) -> {
failedOverOnto(pos);
});
}
deploymentSnapshots = new Set[nodes];
}
代码示例来源:origin: io.vertx/vertx-core
String haGroup = args.map.get("-hagroup");
int quorumSize = args.getInt("-quorum");
options.setHAEnabled(true);
if (haGroup != null) {
options.setHAGroup(haGroup);
代码示例来源:origin: eclipse-vertx/vert.x
options.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime);
options.setMaxWorkerExecuteTime(maxWorkerExecuteTime);
options.setHAEnabled(haEnabled);
options.setFileResolverCachingEnabled(fileResolverCachingEnabled);
options.setQuorumSize(quorumSize);
代码示例来源:origin: io.vertx/vertx-core
protected Vertx startVertx(String haGroup, int quorumSize, boolean ha) throws Exception {
VertxOptions options = new VertxOptions().setHAEnabled(ha).setClustered(true).
setClusterHost("localhost").setClusterManager(getClusterManager());
if (ha) {
options.setQuorumSize(quorumSize);
if (haGroup != null) {
options.setHAGroup(haGroup);
}
}
CountDownLatch latch = new CountDownLatch(1);
AtomicReference<Vertx> vertxRef = new AtomicReference<>();
clusteredVertx(options, onSuccess(vertx -> {
vertxRef.set(vertx);
latch.countDown();
}));
latch.await(2, TimeUnit.MINUTES);
return vertxRef.get();
}
代码示例来源:origin: io.vertx/vertx-core
@Test
public void testSimpleFailover() throws Exception {
startNodes(2, new VertxOptions().setHAEnabled(true));
DeploymentOptions options = new DeploymentOptions().setHa(true);
JsonObject config = new JsonObject().put("foo", "bar");
options.setConfig(config);
CountDownLatch latch = new CountDownLatch(1);
vertices[0].deployVerticle("java:" + HAVerticle1.class.getName(), options, ar -> {
assertTrue(ar.succeeded());
assertEquals(1, vertices[0].deploymentIDs().size());
assertEquals(0, vertices[1].deploymentIDs().size());
latch.countDown();
});
awaitLatch(latch);
kill(0);
assertWaitUntil(() -> vertices[1].deploymentIDs().size() == 1);
checkDeploymentExists(1, "java:" + HAVerticle1.class.getName(), options);
}
代码示例来源:origin: io.vertx/vertx-core
options.setHAEnabled(true);
if (haGroup != null) {
options.setHAGroup(haGroup);
代码示例来源:origin: eclipse-vertx/vert.x
assertSame(mgr, options.getClusterManager());
assertFalse(options.isHAEnabled());
assertEquals(options, options.setHAEnabled(true));
assertTrue(options.isHAEnabled());
rand = TestUtils.randomPositiveInt();
代码示例来源:origin: io.vertx/vertx-core
options.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime);
options.setMaxWorkerExecuteTime(maxWorkerExecuteTime);
options.setHAEnabled(haEnabled);
options.setFileResolverCachingEnabled(fileResolverCachingEnabled);
options.setQuorumSize(quorumSize);
代码示例来源:origin: org.amv.vertx/amv-vertx-spring-boot-starter
@ConditionalOnMissingBean(VertxOptions.class)
@Bean
public VertxOptions vertxOptions(EventBusOptions eventBusOptions, MetricsOptions metricsOptions) {
return new VertxOptions()
.setBlockedThreadCheckInterval(properties.getBlockedThreadCheckInterval())
.setEventLoopPoolSize(properties.getEventLoopPoolSize())
.setWorkerPoolSize(properties.getWorkerPoolSize())
.setInternalBlockingPoolSize(properties.getInternalBlockingPoolSize())
.setQuorumSize(properties.getQuorumSize())
.setMaxEventLoopExecuteTime(properties.getMaxEventLoopExecuteTime())
.setHAGroup(properties.getHaGroup())
.setMaxWorkerExecuteTime(properties.getMaxWorkerExecuteTime())
.setWarningExceptionTime(properties.getWarningExceptionTime())
.setFileResolverCachingEnabled(properties.isFileResolverCachingEnabled())
.setHAEnabled(properties.isHaEnabled())
.setEventBusOptions(eventBusOptions)
.setMetricsOptions(metricsOptions);
}
代码示例来源:origin: io.vertx/vertx-core
assertSame(mgr, options.getClusterManager());
assertFalse(options.isHAEnabled());
assertEquals(options, options.setHAEnabled(true));
assertTrue(options.isHAEnabled());
rand = TestUtils.randomPositiveInt();
内容来源于网络,如有侵权,请联系作者删除!