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

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

本文整理了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

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

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

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

代码示例来源: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. public void fireLifecycleEvent(LifecycleEvent lifecycleEvent) {
  2. getLogger().info(instance.node.getThisAddress() + " is " + lifecycleEvent.getState());
  3. for (LifecycleListener lifecycleListener : lifecycleListeners.values()) {
  4. lifecycleListener.stateChanged(lifecycleEvent);
  5. }
  6. }

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

  1. private boolean isLocalAddress(final Address address) throws UnknownHostException {
  2. final Address thisAddress = node.getThisAddress();
  3. final boolean local = thisAddress.getInetSocketAddress().equals(address.getInetSocketAddress());
  4. if (logger.isFineEnabled()) {
  5. logger.fine(address + " is local? " + local);
  6. }
  7. return local;
  8. }

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

  1. private String versionAndAddressMessage(@Nonnull String addToName) {
  2. JetBuildInfo jetBuildInfo = node.getBuildInfo().getJetBuildInfo();
  3. String build = jetBuildInfo.getBuild();
  4. String revision = jetBuildInfo.getRevision();
  5. if (!revision.isEmpty()) {
  6. build += " - " + revision;
  7. }
  8. return "Hazelcast Jet" + addToName + ' ' + jetBuildInfo.getVersion() +
  9. " (" + build + ") starting at " + node.getThisAddress();
  10. }

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

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

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

  1. private boolean isLocalAddress(final Address address) throws UnknownHostException {
  2. final Address thisAddress = node.getThisAddress();
  3. final boolean local = thisAddress.getInetSocketAddress().equals(address.getInetSocketAddress());
  4. if (logger.isFineEnabled()) {
  5. logger.fine(address + " is local? " + local);
  6. }
  7. return local;
  8. }

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

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

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

  1. private Diagnostics newDiagnostics() {
  2. Address address = node.getThisAddress();
  3. String addressString = address.getHost().replace(":", "_") + "_" + address.getPort();
  4. String name = "diagnostics-" + addressString + "-" + currentTimeMillis();
  5. return new Diagnostics(
  6. name,
  7. loggingService.getLogger(Diagnostics.class),
  8. getHazelcastInstance().getName(),
  9. node.getProperties());
  10. }

代码示例来源: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: com.hazelcast/hazelcast-all

  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: com.hazelcast/hazelcast-all

  1. private Diagnostics newDiagnostics() {
  2. Address address = node.getThisAddress();
  3. String addressString = address.getHost().replace(":", "_") + "_" + address.getPort();
  4. String name = "diagnostics-" + addressString + "-" + currentTimeMillis();
  5. return new Diagnostics(
  6. name,
  7. loggingService.getLogger(Diagnostics.class),
  8. getHazelcastInstance().getName(),
  9. node.getProperties());
  10. }

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

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

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

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

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

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

代码示例来源: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: com.hazelcast/hazelcast-all

  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. /** Sends a {@link ShutdownResponseOperation} to the {@code address} or takes a shortcut if shutdown is local. */
  2. private void sendShutdownOperation(Address address) {
  3. if (node.getThisAddress().equals(address)) {
  4. assert !node.isRunning() : "Node state: " + node.getState();
  5. partitionService.onShutdownResponse();
  6. } else {
  7. nodeEngine.getOperationService().send(new ShutdownResponseOperation(), address);
  8. }
  9. }

代码示例来源: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. }

相关文章