當前位置: 首頁>>代碼示例>>Java>>正文


Java ClusterManager類代碼示例

本文整理匯總了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;
}
 
開發者ID:kuujo,項目名稱:vertigo,代碼行數:23,代碼來源:ClusterListenerFactory.java

示例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.");
		}
	});

}
 
開發者ID:OPEN-ENT-NG,項目名稱:cursus,代碼行數:37,代碼來源:CursusController.java

示例3: clusterManager

import org.vertx.java.core.spi.cluster.ClusterManager; //導入依賴的package包/類
@Override
public ClusterManager clusterManager() {
    return null;
}
 
開發者ID:amoAHCP,項目名稱:vert.x-spring-microservice-demo,代碼行數:5,代碼來源:ServiceInfoTest.java


注:本文中的org.vertx.java.core.spi.cluster.ClusterManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。