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


Java CurrentClusterState類代碼示例

本文整理匯總了Java中akka.cluster.ClusterEvent.CurrentClusterState的典型用法代碼示例。如果您正苦於以下問題:Java CurrentClusterState類的具體用法?Java CurrentClusterState怎麽用?Java CurrentClusterState使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CurrentClusterState類屬於akka.cluster.ClusterEvent包,在下文中一共展示了CurrentClusterState類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createReceive

import akka.cluster.ClusterEvent.CurrentClusterState; //導入依賴的package包/類
@Override
public Receive createReceive() {
    return receiveBuilder()
            .match(ClusterMetricsChanged.class, clusterMetrics -> {
                for (NodeMetrics nodeMetrics : clusterMetrics.getNodeMetrics()) {
                    if (nodeMetrics.address().equals(cluster.selfAddress())) {
                        logHeap(nodeMetrics);
                        logCpu(nodeMetrics);
                    }
                }
            })
            .match(CurrentClusterState.class, message -> {
                // Ignore.
            })
            .build();
}
 
開發者ID:freedompy,項目名稱:commelina,代碼行數:17,代碼來源:MetricsListener.java

示例2: waitForMembersUp

import akka.cluster.ClusterEvent.CurrentClusterState; //導入依賴的package包/類
public void waitForMembersUp(final String... otherMembers) {
    Set<String> otherMembersSet = Sets.newHashSet(otherMembers);
    Stopwatch sw = Stopwatch.createStarted();
    while (sw.elapsed(TimeUnit.SECONDS) <= 10) {
        CurrentClusterState state = Cluster.get(getSystem()).state();
        for (Member m: state.getMembers()) {
            if (m.status() == MemberStatus.up() && otherMembersSet.remove(m.getRoles().iterator().next())
                    && otherMembersSet.isEmpty()) {
                return;
            }
        }

        Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
    }

    fail("Member(s) " + otherMembersSet + " are not Up");
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:18,代碼來源:IntegrationTestKit.java

示例3: waitForMembersUp

import akka.cluster.ClusterEvent.CurrentClusterState; //導入依賴的package包/類
static void waitForMembersUp(final ActorSystem node, final UniqueAddress... addresses) {
    Set<UniqueAddress> otherMembersSet = Sets.newHashSet(addresses);
    Stopwatch sw = Stopwatch.createStarted();
    while (sw.elapsed(TimeUnit.SECONDS) <= 10) {
        CurrentClusterState state = Cluster.get(node).state();
        for (Member m : state.getMembers()) {
            if (m.status() == MemberStatus.up() && otherMembersSet.remove(m.uniqueAddress())
                    && otherMembersSet.isEmpty()) {
                return;
            }
        }

        Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
    }

    fail("Member(s) " + otherMembersSet + " are not Up");
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:18,代碼來源:RpcRegistryTest.java


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