当前位置: 首页>>代码示例>>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;未经允许,请勿转载。