akka.actor.Address.equals()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中akka.actor.Address.equals()方法的一些代码示例,展示了Address.equals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.equals()方法的具体详情如下:
包路径:akka.actor.Address
类名称:Address
方法名:equals

Address.equals介绍

暂无

代码示例

代码示例来源:origin: org.opendaylight.usc/usc-channel-impl

private boolean isLocalAddress(Address address) {
  if (cluster.selfAddress().equals(address)) {
    return true;
  } else {
    return false;
  }
}

代码示例来源:origin: org.opendaylight.controller/sal-remoterpc-connector

/**
 * Add member to the local copy of member list if it doesnt already
 * @param member
 */
void receiveMemberUp(Member member) {
  if (selfAddress.equals(member.address())) {
    return; //ignore up notification for self
  }
  if (!clusterMembers.contains(member.address())) {
    clusterMembers.add(member.address());
  }
  if(log.isDebugEnabled()) {
    log.debug("Added member [{}], Active member list [{}]", member.address(), clusterMembers);
  }
}

代码示例来源:origin: org.eclipse.ditto/ditto-services-utils-cluster

private void handleMemberExited(final ClusterEvent.MemberExited memberExited) {
  log.info("Member EXITED: {}", memberExited.member());
  knownAddresses.keySet()
      .stream()
      .filter(hostname -> knownAddresses.get(hostname).equals(memberExited.member().address()))
      .findFirst()
      .ifPresent(knownAddresses::remove);
  scheduleMajorityCheck();
  cluster.sendCurrentClusterState(getSelf());
}

代码示例来源:origin: org.eclipse.ditto/ditto-services-utils-cluster

private void handleMemberRemoved(final ClusterEvent.MemberRemoved memberRemoved) {
  log.info("Member was REMOVED: {}", memberRemoved.member());
  knownAddresses.keySet()
      .stream()
      .filter(hostname -> knownAddresses.get(hostname).equals(memberRemoved.member().address()))
      .findFirst()
      .ifPresent(knownAddresses::remove);
  scheduleMajorityCheck();
  cluster.sendCurrentClusterState(getSelf());
}

代码示例来源:origin: org.eclipse.ditto/ditto-services-utils-cluster

private void handleMemberLeft(final ClusterEvent.MemberLeft memberLeft) {
  log.info("Member LEFT: {}", memberLeft.member());
  knownAddresses.keySet()
      .stream()
      .filter(hostname -> knownAddresses.get(hostname).equals(memberLeft.member().address()))
      .findFirst()
      .ifPresent(knownAddresses::remove);
  scheduleMajorityCheck();
  cluster.sendCurrentClusterState(getSelf());
}

代码示例来源:origin: opendaylight/controller

/**
 * Add member to the local copy of member list if it doesn't already.
 *
 * @param member the member to add
 */
private void receiveMemberUpOrReachable(final Member member) {
  LOG.debug("Received memberUp or reachable: {}", member);
  //ignore up notification for self
  if (selfAddress.equals(member.address())) {
    return;
  }
  addPeer(member.address());
  LOG.debug("Added member [{}], Active member list [{}]", member.address(), clusterMembers);
}

代码示例来源:origin: opendaylight/controller

final Address addr = entry.getKey();
if (selfAddress.equals(addr)) {

代码示例来源:origin: opendaylight/controller

/**
 * Sends the received buckets in the envelope to the parent Bucket store.
 *
 * @param envelope contains buckets from a remote gossiper
 */
@VisibleForTesting
void receiveGossip(final GossipEnvelope envelope) {
  //TODO: Add more validations
  if (!selfAddress.equals(envelope.to())) {
    LOG.trace("Ignoring message intended for someone else. From [{}] to [{}]", envelope.from(), envelope.to());
    return;
  }
  updateRemoteBuckets(envelope.buckets());
}

代码示例来源:origin: org.opendaylight.controller/sal-remoterpc-connector

/**
 * Sends the received buckets in the envelope to the parent Bucket store.
 *
 * @param envelope contains buckets from a remote gossiper
 */
void receiveGossip(GossipEnvelope envelope){
  //TODO: Add more validations
  if (!selfAddress.equals(envelope.to())) {
    if(log.isTraceEnabled()) {
      log.trace("Ignoring message intended for someone else. From [{}] to [{}]", envelope.from(), envelope.to());
    }
    return;
  }
  updateRemoteBuckets(envelope.getBuckets());
}

代码示例来源:origin: org.opendaylight.controller/sal-remoterpc-connector

/**
 * Remove member from local copy of member list. If member down is self, then stop the actor
 *
 * @param member who went down
 */
void receiveMemberRemoveOrUnreachable(Member member) {
  //if its self, then stop itself
  if (selfAddress.equals(member.address())){
    getContext().stop(getSelf());
    return;
  }
  clusterMembers.remove(member.address());
  if(log.isDebugEnabled()) {
    log.debug("Removed member [{}], Active member list [{}]", member.address(), clusterMembers);
  }
}

代码示例来源:origin: opendaylight/controller

/**
 * Remove member from local copy of member list. If member down is self, then stop the actor
 *
 * @param member who went down
 */
private void receiveMemberRemoveOrUnreachable(final Member member) {
  LOG.debug("Received memberDown or Unreachable: {}", member);
  //if its self, then stop itself
  if (selfAddress.equals(member.address())) {
    getContext().stop(getSelf());
    return;
  }
  removePeer(member.address());
  LOG.debug("Removed member [{}], Active member list [{}]", member.address(), clusterMembers);
}

代码示例来源:origin: org.eclipse.ditto/ditto-services-utils-cluster

unreachableMembers.stream().map(Member::address).filter(a -> a.equals(knownAddress))
    .findFirst().ifPresent(a ->

代码示例来源:origin: ks-no/eventstore2

public void updateLeaderState(ClusterEvent.LeaderChanged leaderChanged) {
  try {
    Cluster cluster = Cluster.get(system);
    boolean oldLeader = leader;
    if (leaderChanged == null ) {
      boolean notReady = true;
      while (!cluster.readView().self().status().equals(MemberStatus.up())) {
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e) {}
      }
      leader = cluster.readView().isLeader();
      leaderAdress = cluster.readView().leader().get();
    } else {
      leaderAdress = leaderChanged.getLeader();
      leader = cluster.readView().selfAddress().equals(leaderAdress);
    }
    log.info("{} leader changed from {} to {}",subscriber, oldLeader, leader);
    log.debug("leader adress {}", leaderAdress);
  } catch (ConfigurationException e) {
    log.debug("Not cluster system");
    leader = true;
  }
}

代码示例来源:origin: org.opendaylight.controller/sal-akka-raft

if(leaderAddress.equals(m.address())) {
  LOG.info("{}: Leader {} is unreachable", logName(), leaderAddress);
  return false;
if(leaderAddress.equals(m.address())) {
  if(m.status() == MemberStatus.up() || m.status() == MemberStatus.weaklyUp()) {
    LOG.debug("{}: Leader {} cluster status is {} - leader is available", logName(),

代码示例来源:origin: ks-no/eventstore2

HashSet<ActorRef> remove = new HashSet<ActorRef>();
for (ActorRef actorRef : aggregateSubscribers.get(aggregate)) {
  if (actorRef.path().address().equals(removed.member().address())) {
    remove.add(actorRef);
    log.debug("removeing actorref {}", actorRef);

代码示例来源:origin: wxyyxc1992/Backend-Boilerplates

@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();
}

代码示例来源:origin: org.opendaylight.netconf/netconf-topology

public void registerMountPoint(final ActorSystem actorSystem, final ActorContext context) {
  if (remoteSchemaContext == null || netconfSessionPreferences == null) {
    LOG.debug("Master mount point does not have schemas ready yet, delaying registration");
    return;
  }
  Preconditions.checkNotNull(id);
  Preconditions.checkNotNull(remoteSchemaContext, "Device has no remote schema context yet. Probably not fully connected.");
  Preconditions.checkNotNull(netconfSessionPreferences, "Device has no capabilities yet. Probably not fully connected.");
  this.actorSystem = actorSystem;
  final NetconfDeviceNotificationService notificationService = new NetconfDeviceNotificationService();
  LOG.warn("Creating master data broker for device {}", id);
  deviceDataBroker = TypedActor.get(context).typedActorOf(new TypedProps<>(ProxyNetconfDeviceDataBroker.class, new Creator<NetconfDeviceMasterDataBroker>() {
    @Override
    public NetconfDeviceMasterDataBroker create() throws Exception {
      return new NetconfDeviceMasterDataBroker(actorSystem, id, remoteSchemaContext, deviceRpc, netconfSessionPreferences);
    }
  }), MOUNT_POINT);
  LOG.debug("Master data broker registered on path {}", TypedActor.get(actorSystem).getActorRefFor(deviceDataBroker).path());
  salProvider.getMountInstance().onTopologyDeviceConnected(remoteSchemaContext, deviceDataBroker, deviceRpc, notificationService);
  final Cluster cluster = Cluster.get(actorSystem);
  final Iterable<Member> members = cluster.state().getMembers();
  final ActorRef deviceDataBrokerRef = TypedActor.get(actorSystem).getActorRefFor(deviceDataBroker);
  for (final Member member : members) {
    if (!member.address().equals(cluster.selfAddress())) {
      final NetconfTopologyPathCreator pathCreator = new NetconfTopologyPathCreator(member.address().toString(),topologyId);
      final String path = pathCreator.withSuffix(id.getName()).build();
      actorSystem.actorSelection(path).tell(new AnnounceMasterMountPoint(), deviceDataBrokerRef);
    }
  }
}

代码示例来源:origin: org.opendaylight.netconf/netconf-topology

public void unregisterMountPoint() {
  salProvider.getMountInstance().onTopologyDeviceDisconnected();
  if (deviceDataBroker != null) {
    LOG.debug("Stopping master data broker for device {}", id.getName());
    for (final Member member : Cluster.get(actorSystem).state().getMembers()) {
      if (member.address().equals(Cluster.get(actorSystem).selfAddress())) {
        continue;
      }
      final NetconfTopologyPathCreator pathCreator = new NetconfTopologyPathCreator(member.address().toString(), topologyId);
      final String path = pathCreator.withSuffix(id.getName()).build();
      actorSystem.actorSelection(path).tell(new AnnounceMasterMountPointDown(), null);
    }
    TypedActor.get(actorSystem).stop(deviceDataBroker);
    deviceDataBroker = null;
  }
}

代码示例来源:origin: org.opendaylight.netconf/netconf-topology

@Override
public void preStart(){
  Cluster cluster = Cluster.get(actorSystem);
  for(Member node : cluster.state().getMembers()) {
    if(!node.address().equals(cluster.selfAddress())) {
      final NetconfTopologyPathCreator pathCreator = new NetconfTopologyPathCreator(node.address().toString(), topologyId);
      final String path = pathCreator.withSuffix(nodeId).withSuffix(NetconfTopologyPathCreator.MASTER_SOURCE_PROVIDER).build();
      actorSystem.actorSelection(path).tell(new AnnounceClusteredDeviceSourcesResolverUp(), TypedActor.context().self());
    }
  }
}

代码示例来源:origin: org.opendaylight.netconf/netconf-topology

@Override
  public void preStart() {
    Cluster cluster = Cluster.get(actorSystem);
    cluster.join(cluster.selfAddress());
    LOG.debug("Notifying members master schema source provider is up.");
    for(Member node : cluster.state().getMembers()) {
      final NetconfTopologyPathCreator pathCreator = new NetconfTopologyPathCreator(node.address().toString(),topologyId);
      final String path = pathCreator.withSuffix(nodeId).withSuffix(NetconfTopologyPathCreator.CLUSTERED_DEVICE_SOURCES_RESOLVER).build();
      if(node.address().equals(cluster.selfAddress())) {
        actorSystem.actorSelection(path).tell(new AnnounceMasterOnSameNodeUp(), TypedActor.context().self());
        actorSystem.actorSelection(path).tell(PoisonPill.getInstance(), TypedActor.context().self());
      } else {
        //TODO extract string constant to util class
        actorSystem.actorSelection(path).tell(new AnnounceMasterSourceProviderUp(), TypedActor.context().self());
      }
    }
  }
}

相关文章