本文整理匯總了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;
}