本文整理汇总了Java中org.vertx.java.core.spi.cluster.ClusterManager类的典型用法代码示例。如果您正苦于以下问题:Java ClusterManager类的具体用法?Java ClusterManager怎么用?Java ClusterManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClusterManager类属于org.vertx.java.core.spi.cluster包,在下文中一共展示了ClusterManager类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHazelcastInstance
import org.vertx.java.core.spi.cluster.ClusterManager; //导入依赖的package包/类
/**
* Returns the Vert.x Hazelcast instance if one exists.
*
* @param vertx The current Vert.x instance.
* @return The Vert.x Hazelcast instance if Vert.x is clustered.
*/
static HazelcastInstance getHazelcastInstance(Vertx vertx) {
VertxInternal vertxInternal = (VertxInternal) vertx;
ClusterManager clusterManager = vertxInternal.clusterManager();
if (clusterManager != null) {
Class<?> clazz = clusterManager.getClass();
Field field;
try {
field = clazz.getDeclaredField("hazelcast");
field.setAccessible(true);
return HazelcastInstance.class.cast(field.get(clusterManager));
} catch (Exception e) {
return null;
}
}
return null;
}
示例2: init
import org.vertx.java.core.spi.cluster.ClusterManager; //导入依赖的package包/类
@Override
public void init(Vertx vertx, final Container container, RouteMatcher rm,
Map<String, fr.wseduc.webutils.security.SecuredAction> securedActions) {
super.init(vertx, container, rm, securedActions);
ConcurrentSharedMap<Object, Object> server = vertx.sharedData().getMap("server");
Boolean cluster = (Boolean) server.get("cluster");
if (Boolean.TRUE.equals(cluster)) {
ClusterManager cm = ((VertxInternal) vertx).clusterManager();
cursusMap = cm.getSyncMap("cursusMap");
} else {
cursusMap = new HashMap<>();
}
/*
service.refreshToken(new Handler<Boolean>() {
public void handle(Boolean res) {
if(!res)
log.error("[Cursus][refreshToken] Error while retrieving the Token.");
else
log.info("[Cursus][refreshToken] Token refreshed.");
}
});
*/
if(cursusMap.containsKey("wallets"))
return;
service.refreshWallets(new Handler<Boolean>() {
public void handle(Boolean res) {
if(!res)
log.error("[Cursus][refreshWallets] Error while retrieving the wallets list.");
else
log.info("[Cursus][refreshWallets] Wallets list refreshed.");
}
});
}
示例3: clusterManager
import org.vertx.java.core.spi.cluster.ClusterManager; //导入依赖的package包/类
@Override
public ClusterManager clusterManager() {
return null;
}