• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MemberUp类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中akka.cluster.ClusterEvent.MemberUp的典型用法代码示例。如果您正苦于以下问题:Java MemberUp类的具体用法?Java MemberUp怎么用?Java MemberUp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MemberUp类属于akka.cluster.ClusterEvent包,在下文中一共展示了MemberUp类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onReceive

import akka.cluster.ClusterEvent.MemberUp; //导入依赖的package包/类
@Override
public void onReceive(Object message) {
  if (message instanceof MemberUp) {
    MemberUp mUp = (MemberUp) message;
    log.info("Member is Up: {}", mUp.member());

  } else if (message instanceof UnreachableMember) {
    UnreachableMember mUnreachable = (UnreachableMember) message;
    log.info("Member detected as unreachable: {}", mUnreachable.member());

  } else if (message instanceof MemberRemoved) {
    MemberRemoved mRemoved = (MemberRemoved) message;
    log.info("Member is Removed: {}", mRemoved.member());

  } else if (message instanceof MemberEvent) {
    // ignore

  } else {
    unhandled(message);
  }
}
 
开发者ID:saturnism,项目名称:akka-kubernetes-example,代码行数:22,代码来源:SimpleClusterListener.java


示例2: onReceive

import akka.cluster.ClusterEvent.MemberUp; //导入依赖的package包/类
/**
 * Overridden super class method. Receives callback messages for cluster membership changes.
 * Updates list of current cluster member addresses based on these updates
 * @see akka.actor.UntypedActor#onReceive(java.lang.Object)
 */
public void onReceive(Object message) {
	if (message instanceof MemberUp) {
		MemberUp mUp = (MemberUp) message;
		logger.info("Cluster Member is Up: " + mUp.member());
		memberAddresses.add(mUp.member().address());
	} else if (message instanceof UnreachableMember) {
		UnreachableMember mUnreachable = (UnreachableMember) message;
		logger.info("Cluster Member detected as unreachable " + mUnreachable.member());
	} else if (message instanceof MemberRemoved) {
		MemberRemoved mRemoved = (MemberRemoved) message;
		logger.info("Cluster Member is Removed: " + mRemoved.member());
		memberAddresses.remove(mRemoved.member().address());
	} else if (message instanceof MemberEvent) {
		// ignore
	} else {
		unhandled(message);
	}
}
 
开发者ID:flipkart-incubator,项目名称:flux,代码行数:24,代码来源:ClusterListener.java


示例3: handleCommand

import akka.cluster.ClusterEvent.MemberUp; //导入依赖的package包/类
@Override
protected void handleCommand(final Object message) throws Exception {
    LOG.debug("{} : Received {}", clusterWrapper.getCurrentMemberName(), message);
    if (message instanceof ClusterEvent.MemberUp) {
        memberUp((ClusterEvent.MemberUp) message);
    } else if (message instanceof ClusterEvent.MemberWeaklyUp) {
        memberWeaklyUp((ClusterEvent.MemberWeaklyUp) message);
    } else if (message instanceof ClusterEvent.MemberExited) {
        memberExited((ClusterEvent.MemberExited) message);
    } else if (message instanceof ClusterEvent.MemberRemoved) {
        memberRemoved((ClusterEvent.MemberRemoved) message);
    } else if (message instanceof ClusterEvent.UnreachableMember) {
        memberUnreachable((ClusterEvent.UnreachableMember) message);
    } else if (message instanceof ClusterEvent.ReachableMember) {
        memberReachable((ClusterEvent.ReachableMember) message);
    } else if (message instanceof ProducerCreated) {
        onProducerCreated((ProducerCreated) message);
    } else if (message instanceof NotifyProducerCreated) {
        onNotifyProducerCreated((NotifyProducerCreated) message);
    } else if (message instanceof ProducerRemoved) {
        onProducerRemoved((ProducerRemoved) message);
    } else if (message instanceof NotifyProducerRemoved) {
        onNotifyProducerRemoved((NotifyProducerRemoved) message);
    } else if (message instanceof PrefixShardCreated) {
        onPrefixShardCreated((PrefixShardCreated) message);
    } else if (message instanceof LookupPrefixShard) {
        onLookupPrefixShard((LookupPrefixShard) message);
    } else if (message instanceof PrefixShardRemovalLookup) {
        onPrefixShardRemovalLookup((PrefixShardRemovalLookup) message);
    } else if (message instanceof PrefixShardRemoved) {
        onPrefixShardRemoved((PrefixShardRemoved) message);
    } else if (message instanceof StartConfigShardLookup) {
        onStartConfigShardLookup((StartConfigShardLookup) message);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:36,代码来源:ShardedDataTreeActor.java


示例4: memberUp

import akka.cluster.ClusterEvent.MemberUp; //导入依赖的package包/类
private void memberUp(final MemberUp message) {
    final MemberName memberName = memberToName(message.member());

    LOG.info("{}: Received MemberUp: memberName: {}, address: {}", persistenceId(), memberName,
            message.member().address());

    resolver.addPeerAddress(memberName, message.member().address());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:ShardedDataTreeActor.java


示例5: preStart

import akka.cluster.ClusterEvent.MemberUp; //导入依赖的package包/类
@Override
public void preStart() {
    cluster.subscribe(getSelf(), MemberUp.class);
    virtualNode = getSelf();
    nodeName = self().path().name();
    Address address = cluster.selfAddress();
    System.out.println("Virtual Node : " + nodeName + " is up @ " + address.protocol() + " : " + address.hostPort());
    this.bootstraper = getContext().actorSelection(address.protocol() + "://" + address.hostPort() + "/user/bootstraper");
    //this.bootstraper.tell(new Identify(nodeName), virtualNode);
    this.ringManager = new ConsistentHash<>(new HashFunction(), numReplicas, new ArrayList<ActorRef>());
    this.localDB = new Memory();
    this.numOfNodes = 0;
}
 
开发者ID:gihankarunarathne,项目名称:dynamo-mini,代码行数:14,代码来源:VirtualNode.java


示例6: createMemberUp

import akka.cluster.ClusterEvent.MemberUp; //导入依赖的package包/类
public static MemberUp createMemberUp(final String memberName, final String address) {
    UniqueAddress uniqueAddress = new UniqueAddress(AddressFromURIString.parse(address), 55L);
    Member member = new Member(uniqueAddress, 1, MemberStatus.up(), setOf(memberName));

    return new MemberUp(member);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:7,代码来源:MockClusterWrapper.java



注:本文中的akka.cluster.ClusterEvent.MemberUp类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SwallowedExceptionListener类代码示例发布时间:2022-05-22
下一篇:
Java DefaultComparisonFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap