com.hazelcast.instance.Node.getThisAddress()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(105)

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

Node.getThisAddress介绍

暂无

代码示例

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

@Override
public void shouldConnectTo(Address address) {
  if (node.getThisAddress().equals(address)) {
    throw new RuntimeException("Connecting to self! " + address);
  }
}

代码示例来源:origin: com.hazelcast/hazelcast-all

/**
   * Verifies that the backup of a partition doesn't end up at the member that also has the primary.
   */
  private void assertNoBackupOnPrimaryMember(InternalPartition partition, Address target) {
    if (target.equals(node.getThisAddress())) {
      throw new IllegalStateException("Normally shouldn't happen! Owner node and backup node "
          + "are the same! " + partition);
    }
  }
}

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

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

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

public void fireLifecycleEvent(LifecycleEvent lifecycleEvent) {
  getLogger().info(instance.node.getThisAddress() + " is " + lifecycleEvent.getState());
  for (LifecycleListener lifecycleListener : lifecycleListeners.values()) {
    lifecycleListener.stateChanged(lifecycleEvent);
  }
}

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

private boolean isLocalAddress(final Address address) throws UnknownHostException {
  final Address thisAddress = node.getThisAddress();
  final boolean local = thisAddress.getInetSocketAddress().equals(address.getInetSocketAddress());
  if (logger.isFineEnabled()) {
    logger.fine(address + " is local? " + local);
  }
  return local;
}

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

private String versionAndAddressMessage(@Nonnull String addToName) {
  JetBuildInfo jetBuildInfo = node.getBuildInfo().getJetBuildInfo();
  String build = jetBuildInfo.getBuild();
  String revision = jetBuildInfo.getRevision();
  if (!revision.isEmpty()) {
    build += " - " + revision;
  }
  return "Hazelcast Jet" + addToName + ' ' + jetBuildInfo.getVersion() +
      " (" + build + ") starting at " + node.getThisAddress();
}

代码示例来源:origin: com.hazelcast/hazelcast-all

public void fireLifecycleEvent(LifecycleEvent lifecycleEvent) {
  getLogger().info(instance.node.getThisAddress() + " is " + lifecycleEvent.getState());
  for (LifecycleListener lifecycleListener : lifecycleListeners.values()) {
    lifecycleListener.stateChanged(lifecycleEvent);
  }
}

代码示例来源:origin: com.hazelcast/hazelcast-all

private boolean isLocalAddress(final Address address) throws UnknownHostException {
  final Address thisAddress = node.getThisAddress();
  final boolean local = thisAddress.getInetSocketAddress().equals(address.getInetSocketAddress());
  if (logger.isFineEnabled()) {
    logger.fine(address + " is local? " + local);
  }
  return local;
}

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

private void addTransactionRecords(ClusterStateChange stateChange, Transaction tx, Collection<MemberImpl> members,
                  int memberListVersion, int partitionStateVersion, boolean isTransient) {
  long leaseTime = Math.min(tx.getTimeoutMillis(), LOCK_LEASE_EXTENSION_MILLIS);
  for (Member member : members) {
    tx.add(new ClusterStateTransactionLogRecord(stateChange, node.getThisAddress(),
        member.getAddress(), tx.getTxnId(), leaseTime, memberListVersion, partitionStateVersion, isTransient));
  }
}

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

private Diagnostics newDiagnostics() {
  Address address = node.getThisAddress();
  String addressString = address.getHost().replace(":", "_") + "_" + address.getPort();
  String name = "diagnostics-" + addressString + "-" + currentTimeMillis();
  return new Diagnostics(
      name,
      loggingService.getLogger(Diagnostics.class),
      getHazelcastInstance().getName(),
      node.getProperties());
}

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

public void onMessage(Object msg) {
    if (msg instanceof SplitBrainJoinMessage) {
      SplitBrainJoinMessage joinRequest = (SplitBrainJoinMessage) msg;
      Address thisAddress = node.getThisAddress();
      // only master nodes execute the SplitBrainHandler that processes SplitBrainJoinMessages
      if (!thisAddress.equals(joinRequest.getAddress()) && node.isMaster()) {
        deque.addFirst(joinRequest);
      }
    }
  }
}

代码示例来源:origin: com.hazelcast/hazelcast-all

public void onMessage(Object msg) {
    if (msg instanceof SplitBrainJoinMessage) {
      SplitBrainJoinMessage joinRequest = (SplitBrainJoinMessage) msg;
      Address thisAddress = node.getThisAddress();
      // only master nodes execute the SplitBrainHandler that processes SplitBrainJoinMessages
      if (!thisAddress.equals(joinRequest.getAddress()) && node.isMaster()) {
        deque.addFirst(joinRequest);
      }
    }
  }
}

代码示例来源:origin: com.hazelcast/hazelcast-all

private Diagnostics newDiagnostics() {
  Address address = node.getThisAddress();
  String addressString = address.getHost().replace(":", "_") + "_" + address.getPort();
  String name = "diagnostics-" + addressString + "-" + currentTimeMillis();
  return new Diagnostics(
      name,
      loggingService.getLogger(Diagnostics.class),
      getHazelcastInstance().getName(),
      node.getProperties());
}

代码示例来源:origin: com.hazelcast/hazelcast-all

final Address getConnectionEndpointOrThisAddress() {
  ClusterServiceImpl clusterService = getService();
  NodeEngineImpl nodeEngine = clusterService.getNodeEngine();
  Node node = nodeEngine.getNode();
  Connection conn = getConnection();
  return conn != null ? conn.getEndPoint() : node.getThisAddress();
}

代码示例来源:origin: com.hazelcast/hazelcast-all

private boolean shouldResetHotRestartData() {
  final NodeExtension nodeExtension = node.getNodeExtension();
  return !nodeExtension.isStartCompleted()
      && nodeExtension.getInternalHotRestartService().isMemberExcluded(node.getThisAddress(), node.getThisUuid());
}

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

private boolean isMemberExcludedFromHotRestart() {
  final NodeExtension nodeExtension = node.getNodeExtension();
  return !nodeExtension.isStartCompleted()
      && nodeExtension.getInternalHotRestartService().isMemberExcluded(node.getThisAddress(), node.getThisUuid());
}

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

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

代码示例来源:origin: com.hazelcast/hazelcast-all

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

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

/** Sends a {@link ShutdownResponseOperation} to the {@code address} or takes a shortcut if shutdown is local. */
private void sendShutdownOperation(Address address) {
  if (node.getThisAddress().equals(address)) {
    assert !node.isRunning() : "Node state: " + node.getState();
    partitionService.onShutdownResponse();
  } else {
    nodeEngine.getOperationService().send(new ShutdownResponseOperation(), address);
  }
}

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

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

相关文章

微信公众号

最新文章

更多