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

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

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

Node.createConfigCheck介绍

暂无

代码示例

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

  1. public NodeMulticastListener(Node node) {
  2. this.node = node;
  3. this.logger = node.getLogger(NodeMulticastListener.class.getName());
  4. this.ourConfig = node.createConfigCheck();
  5. }

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

  1. public NodeMulticastListener(Node node) {
  2. this.node = node;
  3. this.logger = node.getLogger(NodeMulticastListener.class.getName());
  4. this.ourConfig = node.createConfigCheck();
  5. }

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

  1. /**
  2. * Validate that the configuration received from the remote node in {@code joinMessage} is compatible with the
  3. * configuration of this node.
  4. *
  5. * @param joinMessage the {@link JoinMessage} received from another node.
  6. * @return {@code true} if packet version of join message matches this node's packet version and configurations
  7. * are found to be compatible, otherwise {@code false}.
  8. * @throws Exception in case any exception occurred while checking compatibilty
  9. * @see ConfigCheck
  10. */
  11. public boolean validateJoinMessage(JoinMessage joinMessage) throws Exception {
  12. if (joinMessage.getPacketVersion() != Packet.VERSION) {
  13. return false;
  14. }
  15. try {
  16. ConfigCheck newMemberConfigCheck = joinMessage.getConfigCheck();
  17. ConfigCheck clusterConfigCheck = node.createConfigCheck();
  18. return clusterConfigCheck.isCompatible(newMemberConfigCheck);
  19. } catch (Exception e) {
  20. logger.warning(format("Invalid join request from %s, cause: %s", joinMessage.getAddress(), e.getMessage()));
  21. throw e;
  22. }
  23. }

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

  1. /**
  2. * Validate that the configuration received from the remote node in {@code joinMessage} is compatible with the
  3. * configuration of this node.
  4. *
  5. * @param joinMessage the {@link JoinMessage} received from another node.
  6. * @return {@code true} if packet version of join message matches this node's packet version and configurations
  7. * are found to be compatible, otherwise {@code false}.
  8. * @throws Exception in case any exception occurred while checking compatibilty
  9. * @see ConfigCheck
  10. */
  11. public boolean validateJoinMessage(JoinMessage joinMessage) throws Exception {
  12. if (joinMessage.getPacketVersion() != Packet.VERSION) {
  13. return false;
  14. }
  15. try {
  16. ConfigCheck newMemberConfigCheck = joinMessage.getConfigCheck();
  17. ConfigCheck clusterConfigCheck = node.createConfigCheck();
  18. return clusterConfigCheck.isCompatible(newMemberConfigCheck);
  19. } catch (Exception e) {
  20. logger.warning(format("Invalid join request from %s, cause: %s", joinMessage.getAddress(), e.getMessage()));
  21. throw e;
  22. }
  23. }

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

  1. public JoinRequest createJoinRequest(boolean withCredentials) {
  2. final Credentials credentials = (withCredentials && securityContext != null)
  3. ? securityContext.getCredentialsFactory().newCredentials() : null;
  4. final Set<String> excludedMemberUuids = nodeExtension.getInternalHotRestartService().getExcludedMemberUuids();
  5. MemberImpl localMember = getLocalMember();
  6. return new JoinRequest(Packet.VERSION, buildInfo.getBuildNumber(), version, address,
  7. localMember.getUuid(), localMember.isLiteMember(), createConfigCheck(), credentials,
  8. localMember.getAttributes(), excludedMemberUuids);
  9. }

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

  1. public JoinRequest createJoinRequest(boolean withCredentials) {
  2. final Credentials credentials = (withCredentials && securityContext != null)
  3. ? securityContext.getCredentialsFactory().newCredentials() : null;
  4. final Set<String> excludedMemberUuids = nodeExtension.getInternalHotRestartService().getExcludedMemberUuids();
  5. MemberImpl localMember = getLocalMember();
  6. return new JoinRequest(Packet.VERSION, buildInfo.getBuildNumber(), version, address,
  7. localMember.getUuid(), localMember.isLiteMember(), createConfigCheck(), credentials,
  8. localMember.getAttributes(), excludedMemberUuids);
  9. }

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

  1. public SplitBrainJoinMessage createSplitBrainJoinMessage() {
  2. MemberImpl localMember = getLocalMember();
  3. boolean liteMember = localMember.isLiteMember();
  4. Collection<Address> memberAddresses = clusterService.getMemberAddresses();
  5. int dataMemberCount = clusterService.getSize(DATA_MEMBER_SELECTOR);
  6. Version clusterVersion = clusterService.getClusterVersion();
  7. int memberListVersion = clusterService.getMembershipManager().getMemberListVersion();
  8. return new SplitBrainJoinMessage(Packet.VERSION, buildInfo.getBuildNumber(), version, address, localMember.getUuid(),
  9. liteMember, createConfigCheck(), memberAddresses, dataMemberCount, clusterVersion, memberListVersion);
  10. }

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

  1. public SplitBrainJoinMessage createSplitBrainJoinMessage() {
  2. MemberImpl localMember = getLocalMember();
  3. boolean liteMember = localMember.isLiteMember();
  4. Collection<Address> memberAddresses = clusterService.getMemberAddresses();
  5. int dataMemberCount = clusterService.getSize(DATA_MEMBER_SELECTOR);
  6. Version clusterVersion = clusterService.getClusterVersion();
  7. int memberListVersion = clusterService.getMembershipManager().getMemberListVersion();
  8. return new SplitBrainJoinMessage(Packet.VERSION, buildInfo.getBuildNumber(), version, address, localMember.getUuid(),
  9. liteMember, createConfigCheck(), memberAddresses, dataMemberCount, clusterVersion, memberListVersion);
  10. }

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

  1. /**
  2. * Send a {@link WhoisMasterOp} to designated address.
  3. *
  4. * @param toAddress the address to which the operation will be sent.
  5. * @return {@code true} if the operation was sent, otherwise {@code false}.
  6. */
  7. public boolean sendMasterQuestion(Address toAddress) {
  8. checkNotNull(toAddress, "No endpoint is specified!");
  9. BuildInfo buildInfo = node.getBuildInfo();
  10. final Address thisAddress = node.getThisAddress();
  11. JoinMessage joinMessage = new JoinMessage(Packet.VERSION, buildInfo.getBuildNumber(), node.getVersion(),
  12. thisAddress, clusterService.getThisUuid(), node.isLiteMember(), node.createConfigCheck());
  13. return nodeEngine.getOperationService().send(new WhoisMasterOp(joinMessage), toAddress);
  14. }

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

  1. /**
  2. * Send a {@link WhoisMasterOp} to designated address.
  3. *
  4. * @param toAddress the address to which the operation will be sent.
  5. * @return {@code true} if the operation was sent, otherwise {@code false}.
  6. */
  7. public boolean sendMasterQuestion(Address toAddress) {
  8. checkNotNull(toAddress, "No endpoint is specified!");
  9. BuildInfo buildInfo = node.getBuildInfo();
  10. final Address thisAddress = node.getThisAddress();
  11. JoinMessage joinMessage = new JoinMessage(Packet.VERSION, buildInfo.getBuildNumber(), node.getVersion(),
  12. thisAddress, clusterService.getThisUuid(), node.isLiteMember(), node.createConfigCheck());
  13. return nodeEngine.getOperationService().send(new WhoisMasterOp(joinMessage), toAddress);
  14. }

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

  1. private void handleActiveAndJoined(JoinMessage joinMessage) {
  2. if (!(joinMessage instanceof JoinRequest)) {
  3. logDroppedMessage(joinMessage);
  4. return;
  5. }
  6. ClusterServiceImpl clusterService = node.getClusterService();
  7. Address masterAddress = clusterService.getMasterAddress();
  8. if (clusterService.isMaster()) {
  9. JoinMessage response = new JoinMessage(Packet.VERSION, node.getBuildInfo().getBuildNumber(), node.getVersion(),
  10. node.getThisAddress(), node.getThisUuid(), node.isLiteMember(), node.createConfigCheck());
  11. node.multicastService.send(response);
  12. } else if (joinMessage.getAddress().equals(masterAddress)) {
  13. MemberImpl master = node.getClusterService().getMember(masterAddress);
  14. if (master != null && !master.getUuid().equals(joinMessage.getUuid())) {
  15. String message = "New join request has been received from current master. Suspecting " + masterAddress;
  16. logger.warning(message);
  17. // I just make a local suspicion. Probably other nodes will eventually suspect as well.
  18. clusterService.suspectMember(master, message, false);
  19. }
  20. }
  21. }

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

  1. private void handleActiveAndJoined(JoinMessage joinMessage) {
  2. if (!(joinMessage instanceof JoinRequest)) {
  3. logDroppedMessage(joinMessage);
  4. return;
  5. }
  6. ClusterServiceImpl clusterService = node.getClusterService();
  7. Address masterAddress = clusterService.getMasterAddress();
  8. if (clusterService.isMaster()) {
  9. JoinMessage response = new JoinMessage(Packet.VERSION, node.getBuildInfo().getBuildNumber(), node.getVersion(),
  10. node.getThisAddress(), node.getThisUuid(), node.isLiteMember(), node.createConfigCheck());
  11. node.multicastService.send(response);
  12. } else if (joinMessage.getAddress().equals(masterAddress)) {
  13. MemberImpl master = node.getClusterService().getMember(masterAddress);
  14. if (master != null && !master.getUuid().equals(joinMessage.getUuid())) {
  15. String message = "New join request has been received from current master. Suspecting " + masterAddress;
  16. logger.warning(message);
  17. // I just make a local suspicion. Probably other nodes will eventually suspect as well.
  18. clusterService.suspectMember(master, message, false);
  19. }
  20. }
  21. }

相关文章