本文整理汇总了Java中io.vertx.core.spi.cluster.ClusterManager类的典型用法代码示例。如果您正苦于以下问题:Java ClusterManager类的具体用法?Java ClusterManager怎么用?Java ClusterManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClusterManager类属于io.vertx.core.spi.cluster包,在下文中一共展示了ClusterManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: startCluster
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
private void startCluster(final ClusterManager manager,
final Consumer<Vertx> consumer) {
Motor.each((name, option) -> {
Vertx.clusteredVertx(option, clustered -> {
// 1. Async clustered vertx initialized
final Vertx vertx = clustered.result();
// 2. Codecs
Motor.codec(vertx.eventBus());
// 3. Cluster connect
manager.setVertx(vertx);
// Finalized
VERTX.putIfAbsent(name, vertx);
consumer.accept(vertx);
});
});
}
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:18,代码来源:ZeroLauncher.java
示例2: start
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
public static <T> void start(
final Class<?> clazz,
final Consumer<T> consumer,
final Consumer<Consumer<T>> fnSingle,
final BiConsumer<ClusterManager, Consumer<T>> fnCluster,
final Annal logger) {
if (null == consumer) {
throw new VertxCallbackException(clazz);
}
// 1. Check if clustered mode
final ClusterOptions cluster = ZeroGrid.getClusterOption();
if (cluster.isEnabled()) {
// 2.1. Clustered
final ClusterManager manager = cluster.getManager();
logger.info(Info.APP_CLUSTERD, manager.getClass().getName(),
manager.getNodeID(), manager.isActive());
fnCluster.accept(manager, consumer);
} else {
// 2.2. Standalone
fnSingle.accept(consumer);
}
}
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:23,代码来源:Motor.java
示例3: fromJson
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
static void fromJson(final JsonObject json, final ClusterOptions obj) {
if (json.getValue("enabled") instanceof Boolean) {
obj.setEnabled(json.getBoolean("enabled"));
}
if (json.getValue("options") instanceof JsonObject) {
obj.setOptions(json.getJsonObject("options"));
}
final Object managerObj = json.getValue("manager");
Fn.safeNull(() -> {
final Class<?> clazz = Instance.clazz(managerObj.toString());
Fn.safeNull(() -> {
// If null, keep default
final ClusterManager manager = Instance.instance(clazz);
obj.setManager(manager);
}, clazz);
}, managerObj);
}
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:18,代码来源:ClusterOptionsConverter.java
示例4: initVerticle
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
private void initVerticle(Handler<Object> handler){
//start vert.x
ClusterManager mgr = new HazelcastClusterManager();
VertxOptions options = new VertxOptions().setClusterManager(mgr);
options.setWorkerPoolSize(1000);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
vertx = res.result();
vertx.eventBus().registerDefaultCodec(MessageBody.class, new MessageBodyCodec());
AppConfig appConfig = context.getBean(AppConfig.class);
appConfig.setVertx(vertx);
appConfig.setAppClass(appClass);
appConfig.setAppName(appName);
handler.handle(1);
} else {
logger.error("fail clusteredVertx");
}
});
}
开发者ID:quebic-source,项目名称:puppy-io,代码行数:25,代码来源:PuppyAppLauncher.java
示例5: DisplayManager
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
public DisplayManager(){
LOG.info("\n-----------------------------------\n" +
"Starting DisplayDisplayManager...\n" +
"-----------------------------------");
LOG.info("--- Starting Vertx cluster...");
// Reusing the hazelcast instance already in place for vertx...
ClusterManager mgr = new HazelcastClusterManager(
hazelCastPropertySource.getHazelcastInstance());
VertxOptions vertxOptions = new VertxOptions().setClusterManager(mgr);
Vertx.clusteredVertx(vertxOptions, h -> {
vertx = h.result();
});
LOG.info("--- Waiting for Vertx cluster...");
while(vertx==null){
try {
Thread.sleep(100L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
monitorField.getStyleClass().add("monitor");
configField.getStyleClass().add("config");
}
开发者ID:apache,项目名称:incubator-tamaya,代码行数:24,代码来源:DisplayManager.java
示例6: example2
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
public void example2() {
Config hazelcastConfig = new Config();
// Now set some stuff on the config (omitted)
ClusterManager mgr = new HazelcastClusterManager(hazelcastConfig);
VertxOptions options = new VertxOptions().setClusterManager(mgr);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
} else {
// failed!
}
});
}
开发者ID:vert-x3,项目名称:vertx-hazelcast,代码行数:19,代码来源:Examples.java
示例7: startCluster
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
private void startCluster(final ClusterManager manager,
final Consumer<Vertx> consumer) {
Motor.each((name, option) -> {
// Set cluster manager
option.setClusterManager(manager);
final Single<Vertx> observable = Vertx.rxClusteredVertx(option);
observable.subscribe(vertx -> {
Motor.codec(vertx.eventBus().getDelegate());
// Finalized
VERTX.putIfAbsent(name, vertx);
consumer.accept(vertx);
});
});
}
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:16,代码来源:ZeroLauncher.java
示例8: start
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
@Activate
public void start(BundleContext bundleContext) {
this.bc = bundleContext;
LOGGER.info("Starting VertxHazelcastClusterMngrFactory ... registering ClusterManager as service.");
ClusterManager mgr = new HazelcastClusterManager(hazelcastInstance);
clusterManagerService = bc.registerService(ClusterManager.class, mgr, null);
}
开发者ID:ANierbeck,项目名称:Karaf-Vertx,代码行数:8,代码来源:VertxHazelcastClusterMngrFactory.java
示例9: example1
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
public void example1() {
ClusterManager clusterManager = new IgniteClusterManager();
VertxOptions options = new VertxOptions().setClusterManager(clusterManager);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
} else {
// failed!
}
});
}
开发者ID:vert-x3,项目名称:vertx-ignite,代码行数:13,代码来源:Examples.java
示例10: example2
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
public void example2() {
IgniteConfiguration cfg = new IgniteConfiguration();
// Configuration code (omitted)
ClusterManager clusterManager = new IgniteClusterManager(cfg);
VertxOptions options = new VertxOptions().setClusterManager(clusterManager);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
} else {
// failed!
}
});
}
开发者ID:vert-x3,项目名称:vertx-ignite,代码行数:16,代码来源:Examples.java
示例11: example3
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
public void example3(Ignite ignite) {
// Configuration code (omitted)
ClusterManager clusterManager = new IgniteClusterManager(ignite);
VertxOptions options = new VertxOptions().setClusterManager(clusterManager);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
} else {
// failed!
}
});
}
开发者ID:vert-x3,项目名称:vertx-ignite,代码行数:15,代码来源:Examples.java
示例12: createClusterManagerProgramatically
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
public void createClusterManagerProgramatically() {
ClusterManager mgr = new InfinispanClusterManager();
VertxOptions options = new VertxOptions().setClusterManager(mgr);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
} else {
// failed!
}
});
}
开发者ID:vert-x3,项目名称:vertx-infinispan,代码行数:14,代码来源:Examples.java
示例13: useExistingCacheManager
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
public void useExistingCacheManager(DefaultCacheManager cacheManager) {
ClusterManager mgr = new InfinispanClusterManager(cacheManager);
VertxOptions options = new VertxOptions().setClusterManager(mgr);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
} else {
// failed!
}
});
}
开发者ID:vert-x3,项目名称:vertx-infinispan,代码行数:14,代码来源:Examples.java
示例14: ExtendedAsyncMapImpl
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
public ExtendedAsyncMapImpl(Vertx vertx, String name) {
this.vertx = vertx;
ClusterManager clusterManager = ((VertxInternal) vertx).getClusterManager();
if (clusterManager == null) {
syncMap = new ConcurrentHashMap<>();
} else {
syncMap = clusterManager.getSyncMap(name);
}
}
开发者ID:cescoffier,项目名称:vertx-discovery-service,代码行数:10,代码来源:ExtendedAsyncMapImpl.java
示例15: logVertxOptions
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
private void logVertxOptions() {
LOG.logp(CONFIG, getClass().getName(), "logVertxOptions", () -> {
final JsonObject json = new JsonObject()
.put("BlockedThreadCheckInterval", vertxOptions.getBlockedThreadCheckInterval())
.put("ClusterHost", vertxOptions.getClusterHost())
.put("ClusterPingInterval", vertxOptions.getClusterPingInterval())
.put("ClusterPingReplyInterval", vertxOptions.getClusterPingReplyInterval())
.put("ClusterPort", vertxOptions.getClusterPort())
.put("EventLoopPoolSize", vertxOptions.getEventLoopPoolSize())
.put("HAGroup", vertxOptions.getHAGroup())
.put("InternalBlockingPoolSize", vertxOptions.getInternalBlockingPoolSize())
.put("MaxEventLoopExecuteTime", vertxOptions.getMaxEventLoopExecuteTime())
.put("MaxWorkerExecuteTime", vertxOptions.getMaxWorkerExecuteTime())
.put("QuorumSize", vertxOptions.getQuorumSize())
.put("WarningExceptionTime", vertxOptions.getWarningExceptionTime())
.put("WorkerPoolSize", vertxOptions.getWorkerPoolSize());
final ClusterManager clusterManager = vertxOptions.getClusterManager();
if (clusterManager != null) {
json.put("clusterManagerClass", clusterManager.getClass().getName());
}
final MetricsOptions metricsOptions = vertxOptions.getMetricsOptions();
if (metricsOptions != null) {
json.put("MetricsOptions", toJsonObject(metricsOptions));
}
return json.encodePrettily();
});
}
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:30,代码来源:VertxServiceImpl.java
示例16: getHazelcastInstance
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
@Override
public Optional<HazelcastInstance> getHazelcastInstance() {
if (!this.vertx.isClustered()) {
return Optional.empty();
}
final ClusterManager clusterManager = this.vertxOptions.getClusterManager();
if (clusterManager != null && clusterManager instanceof HazelcastClusterManager) {
return Optional.of(((HazelcastClusterManager) clusterManager).getHazelcastInstance());
}
return Optional.empty();
}
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:14,代码来源:VertxServiceImpl.java
示例17: example1
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
public void example1() {
ClusterManager mgr = new JGroupsClusterManager();
VertxOptions options = new VertxOptions().setClusterManager(mgr);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
} else {
// failed!
}
});
}
开发者ID:vert-x3,项目名称:vertx-jgroups,代码行数:12,代码来源:Examples.java
示例18: example2
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
public void example2(JChannel channel) {
ClusterManager mgr = new JGroupsClusterManager(channel);
VertxOptions options = new VertxOptions().setClusterManager(mgr);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
} else {
// failed!
}
});
// Don't forget to close the channel when done.
}
开发者ID:vert-x3,项目名称:vertx-jgroups,代码行数:14,代码来源:Examples.java
示例19: main
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
public static void main(String[] args) {
ClusterManager clusterManager = new HazelcastClusterManager();
VertxOptions vertxOptions = new VertxOptions().setClusterManager(clusterManager);
Vertx.clusteredVertx(vertxOptions, res -> {
if(res.succeeded()) {
vertx = res.result();
initRouter();
addVerticle();
}else {
throw new RuntimeException("Vert.x Init Error");
}
});
}
开发者ID:zhongzhaoyl,项目名称:wxvertx,代码行数:15,代码来源:Launcher.java
示例20: Display
import io.vertx.core.spi.cluster.ClusterManager; //导入依赖的package包/类
public Display(){
LOG.info("\n-----------------------------------\n" +
"Starting Display...\n" +
"-----------------------------------");
LOG.info("--- Starting Vertx cluster...");
// Reusing the hazelcast instance already in place for vertx...
ClusterManager mgr = new HazelcastClusterManager(
hazelCastPropertySource.getHazelcastInstance());
VertxOptions vertxOptions = new VertxOptions().setClusterManager(mgr);
Vertx.clusteredVertx(vertxOptions, h -> {
vertx = h.result();
});
LOG.info("--- Waiting for Vertx cluster...");
while(vertx==null){
try {
Thread.sleep(100L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
titleField.getStyleClass().add("title");
contentField.getStyleClass().add("content");
monitorField.getStyleClass().add("monitor");
titleField.setId("title");
titleField.setEditable(false);
contentField.setId("scene");
contentField.setEditable(false);
}
开发者ID:apache,项目名称:incubator-tamaya,代码行数:29,代码来源:Display.java
注:本文中的io.vertx.core.spi.cluster.ClusterManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论