com.hazelcast.nio.Address.equals()方法的使用及代码示例

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

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

Address.equals介绍

暂无

代码示例

代码示例来源:origin: hazelcast/hazelcast-jet

  1. private void addAllFilterJobOwner(Set<Address> target, Set<Address> source) {
  2. for (Address address : source) {
  3. if (jobOwner.equals(address)) {
  4. continue;
  5. }
  6. target.add(address);
  7. }
  8. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. private static int[] arrangeLocalPartitions(Address[] partitionOwners, Address thisAddress) {
  2. return IntStream.range(0, partitionOwners.length)
  3. .filter(partitionId -> thisAddress.equals(partitionOwners[partitionId]))
  4. .toArray();
  5. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. private static Map<Address, int[]> remotePartitionAssignment(Address[] partitionOwners, Address thisAddress) {
  2. Map<Address, List<Integer>> addrToPartitions = IntStream.range(0, partitionOwners.length)
  3. .filter(partitionId -> !thisAddress.equals(partitionOwners[partitionId]))
  4. .boxed()
  5. .collect(groupingBy(partitionId -> partitionOwners[partitionId]));
  6. return addrToPartitions.entrySet().stream().collect(toMap(
  7. Map.Entry::getKey, e -> e.getValue().stream().mapToInt(x -> x).toArray()));
  8. }
  9. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. /**
  2. * Returns {@code true} if local member is the caller.
  3. * <p>
  4. * <b>Note:</b> On the caller member this method always returns {@code
  5. * true}. It's meant to be used on target member to determine if the
  6. * execution is local.
  7. */
  8. public boolean executedLocally() {
  9. return nodeEngine.getThisAddress().equals(callerAddress);
  10. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. @Override
  2. public boolean isOwnerOrBackup(Address address) {
  3. if (address == null) {
  4. return false;
  5. }
  6. for (int i = 0; i < MAX_REPLICA_COUNT; i++) {
  7. if (address.equals(getAddress(replicas[i]))) {
  8. return true;
  9. }
  10. }
  11. return false;
  12. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. public MemberInfo getMember(Address address) {
  2. for (MemberInfo member : members) {
  3. if (member.getAddress().equals(address)) {
  4. return member;
  5. }
  6. }
  7. return null;
  8. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. public boolean containsMember(Address address, String uuid) {
  2. for (MemberInfo member : members) {
  3. if (member.getAddress().equals(address)) {
  4. return member.getUuid().equals(uuid);
  5. }
  6. }
  7. return false;
  8. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. private boolean isMessageToSelf(JoinMessage joinMessage) {
  2. Address thisAddress = node.getThisAddress();
  3. return thisAddress == null || thisAddress.equals(joinMessage.getAddress());
  4. }
  5. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. /** Verifies that the local master is equal to the migration master. */
  2. final void verifyMaster() {
  3. NodeEngine nodeEngine = getNodeEngine();
  4. Address masterAddress = nodeEngine.getMasterAddress();
  5. if (!migrationInfo.getMaster().equals(masterAddress)) {
  6. throw new IllegalStateException("Migration initiator is not master node! => " + toString());
  7. }
  8. if (getMigrationParticipantType() == MigrationParticipant.SOURCE && !masterAddress.equals(getCallerAddress())) {
  9. throw new IllegalStateException("Caller is not master node! => " + toString());
  10. }
  11. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. private boolean isPrimary() {
  2. final Address owner = nodeEngine.getPartitionService().getPartition(partitionId, false).getOwnerOrNull();
  3. final Address thisAddress = nodeEngine.getThisAddress();
  4. return owner != null && owner.equals(thisAddress);
  5. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. private boolean ensureValidBindTarget(TcpIpConnection connection, Address remoteEndPoint, Address localEndpoint,
  2. Address thisAddress) {
  3. if (ioService.isSocketBindAny() && !connection.isClient() && !thisAddress.equals(localEndpoint)) {
  4. String msg = "Wrong bind request from " + remoteEndPoint
  5. + "! This node is not the requested endpoint: " + localEndpoint;
  6. logger.warning(msg);
  7. connection.close(msg, null);
  8. return false;
  9. }
  10. return true;
  11. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. public void onMessage(Object msg) {
  2. if (msg instanceof SplitBrainJoinMessage) {
  3. SplitBrainJoinMessage joinRequest = (SplitBrainJoinMessage) msg;
  4. Address thisAddress = node.getThisAddress();
  5. // only master nodes execute the SplitBrainHandler that processes SplitBrainJoinMessages
  6. if (!thisAddress.equals(joinRequest.getAddress()) && node.isMaster()) {
  7. deque.addFirst(joinRequest);
  8. }
  9. }
  10. }
  11. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. private boolean isOwner() {
  2. final NodeEngine nodeEngine = getNodeEngine();
  3. final Address owner = nodeEngine.getPartitionService().getPartitionOwner(getPartitionId());
  4. return nodeEngine.getThisAddress().equals(owner);
  5. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. private boolean isOwner() {
  2. final NodeEngine nodeEngine = getNodeEngine();
  3. final Address owner = nodeEngine.getPartitionService().getPartitionOwner(getPartitionId());
  4. return nodeEngine.getThisAddress().equals(owner);
  5. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. public boolean handleRegistration(Registration reg) {
  2. if (nodeEngine.getThisAddress().equals(reg.getSubscriber())) {
  3. return false;
  4. }
  5. EventServiceSegment segment = getSegment(reg.getServiceName(), true);
  6. return segment.addRegistration(reg.getTopic(), reg);
  7. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. void sendExplicitSuspicionTrigger(Address triggerTo, MembersViewMetadata endpointMembersViewMetadata) {
  2. if (triggerTo.equals(node.getThisAddress())) {
  3. logger.warning("Cannot send explicit suspicion trigger for " + endpointMembersViewMetadata + " to itself.");
  4. return;
  5. }
  6. int memberListVersion = membershipManager.getMemberListVersion();
  7. Operation op = new TriggerExplicitSuspicionOp(memberListVersion, endpointMembersViewMetadata);
  8. OperationService operationService = nodeEngine.getOperationService();
  9. operationService.send(op, triggerTo);
  10. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. @Override
  2. public Object getResponse() {
  3. if (getNodeEngine().getThisAddress().equals(getCallerAddress())) {
  4. return response;
  5. } else {
  6. return new NormalResponse(response, getCallId(), 1, isUrgent());
  7. }
  8. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. public JobSupervisor createJobSupervisor(JobTaskConfiguration configuration) {
  2. // Job might already be cancelled (due to async processing)
  3. NodeJobTracker jobTracker = (NodeJobTracker) createDistributedObject(configuration.getName());
  4. if (jobTracker.unregisterJobSupervisorCancellation(configuration.getJobId())) {
  5. return null;
  6. }
  7. JobSupervisorKey key = new JobSupervisorKey(configuration.getName(), configuration.getJobId());
  8. boolean ownerNode = nodeEngine.getThisAddress().equals(configuration.getJobOwner());
  9. JobSupervisor jobSupervisor = new JobSupervisor(configuration, jobTracker, ownerNode, this);
  10. JobSupervisor oldSupervisor = jobSupervisors.putIfAbsent(key, jobSupervisor);
  11. return oldSupervisor != null ? oldSupervisor : jobSupervisor;
  12. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. private MemberImpl createMember(MemberInfo memberInfo, Map<String, Object> attributes) {
  2. Address address = memberInfo.getAddress();
  3. Address thisAddress = node.getThisAddress();
  4. String ipV6ScopeId = thisAddress.getScopeId();
  5. address.setScopeId(ipV6ScopeId);
  6. boolean localMember = thisAddress.equals(address);
  7. return new MemberImpl(address, memberInfo.getVersion(), localMember, memberInfo.getUuid(), attributes,
  8. memberInfo.isLiteMember(), memberInfo.getMemberListJoinVersion(), node.hazelcastInstance);
  9. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. @Override
  2. public void run() throws Exception {
  3. service = getService();
  4. ReplicatedRecordStore store = service.getReplicatedRecordStore(name, true, getPartitionId());
  5. Object removed = store.remove(key);
  6. oldValue = getNodeEngine().toData(removed);
  7. response = new VersionResponsePair(removed, store.getVersion());
  8. Address thisAddress = getNodeEngine().getThisAddress();
  9. if (!getCallerAddress().equals(thisAddress)) {
  10. sendUpdateCallerOperation(true);
  11. }
  12. }

相关文章