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

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

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

Node.getClusterService介绍

暂无

代码示例

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

  1. @Override
  2. public Cluster getCluster() {
  3. return node.getClusterService();
  4. }

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

  1. private void checkMemberListVersion(int memberListVersion) {
  2. int thisMemberListVersion = node.getClusterService().getMemberListVersion();
  3. if (memberListVersion != thisMemberListVersion) {
  4. throw new IllegalStateException(
  5. "Can not lock cluster state! Member list versions are not matching!"
  6. + " Expected version: " + memberListVersion
  7. + ", Current version: " + thisMemberListVersion);
  8. }
  9. }

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

  1. private static boolean isFirstMember(Node node) {
  2. Iterator<Member> iterator = node.getClusterService().getMembers().iterator();
  3. return (iterator.hasNext() && iterator.next().localMember());
  4. }

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

  1. private void checkMemberListChange(int initialMemberListVersion) {
  2. int currentMemberListVersion = node.getClusterService().getMembershipManager().getMemberListVersion();
  3. if (initialMemberListVersion != currentMemberListVersion) {
  4. throw new IllegalStateException("Cluster members changed during state change! "
  5. + "Initial version: " + initialMemberListVersion + ", Current version: " + currentMemberListVersion);
  6. }
  7. }

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

  1. private void checkMemberListVersion(int memberListVersion) {
  2. // RU_COMPAT_V3_10
  3. if (clusterVersion.isGreaterOrEqual(Versions.V3_11)) {
  4. int thisMemberListVersion = node.getClusterService().getMemberListVersion();
  5. if (memberListVersion != thisMemberListVersion) {
  6. throw new IllegalStateException(
  7. "Can not lock cluster state! Member list versions are not matching!"
  8. + " Expected version: " + memberListVersion
  9. + ", Current version: " + thisMemberListVersion);
  10. }
  11. }
  12. }

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

  1. private void checkMemberListChange(int initialMemberListVersion) {
  2. int currentMemberListVersion = node.getClusterService().getMembershipManager().getMemberListVersion();
  3. if (initialMemberListVersion != currentMemberListVersion) {
  4. throw new IllegalStateException("Cluster members changed during state change! "
  5. + "Initial version: " + initialMemberListVersion + ", Current version: " + currentMemberListVersion);
  6. }
  7. }

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

  1. /**
  2. * Returns whether migrations are allowed by current cluster state.
  3. */
  4. private boolean isMigrationAllowedByClusterState() {
  5. ClusterState clusterState = node.getClusterService().getClusterState();
  6. return clusterState.isMigrationAllowed();
  7. }

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

  1. @Override
  2. public void onSuccessfulConnection(Address address) {
  3. if (!node.getClusterService().isJoined()) {
  4. node.getJoiner().unblacklist(address);
  5. }
  6. }

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

  1. private Collection<MemberGroup> createMemberGroups(final Set<Member> excludedMembers) {
  2. MemberSelector exclude = new MemberSelector() {
  3. @Override
  4. public boolean select(Member member) {
  5. return !excludedMembers.contains(member);
  6. }
  7. };
  8. final MemberSelector selector = MemberSelectors.and(DATA_MEMBER_SELECTOR, exclude);
  9. final Collection<Member> members = node.getClusterService().getMembers(selector);
  10. return memberGroupFactory.createMemberGroups(members);
  11. }

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

  1. private Version getClusterOrNodeVersion() {
  2. if (node.getClusterService() != null && !node.getClusterService().getClusterVersion().isUnknown()) {
  3. return node.getClusterService().getClusterVersion();
  4. } else {
  5. String overriddenClusterVersion = node.getProperties().getString(GroupProperty.INIT_CLUSTER_VERSION);
  6. return (overriddenClusterVersion != null) ? MemberVersion.of(overriddenClusterVersion).asVersion()
  7. : node.getVersion().asVersion();
  8. }
  9. }

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

  1. private void handleGetClusterVersion(HttpGetCommand command) {
  2. String res = "{\"status\":\"${STATUS}\",\"version\":\"${VERSION}\"}";
  3. Node node = textCommandService.getNode();
  4. ClusterService clusterService = node.getClusterService();
  5. res = res.replace("${STATUS}", "success");
  6. res = res.replace("${VERSION}", clusterService.getClusterVersion().toString());
  7. command.setResponse(HttpCommand.CONTENT_TYPE_JSON, stringToBytes(res));
  8. }

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

  1. public AbstractJoiner(Node node) {
  2. this.node = node;
  3. this.logger = node.loggingService.getLogger(getClass());
  4. this.config = node.config;
  5. this.clusterService = node.getClusterService();
  6. this.clusterJoinManager = clusterService.getClusterJoinManager();
  7. this.mergeNextRunDelayMs = node.getProperties().getMillis(GroupProperty.MERGE_NEXT_RUN_DELAY_SECONDS);
  8. }

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

  1. private Version getClusterOrNodeVersion() {
  2. if (node.getClusterService() != null && !node.getClusterService().getClusterVersion().isUnknown()) {
  3. return node.getClusterService().getClusterVersion();
  4. } else {
  5. String overriddenClusterVersion = node.getProperties().getString(GroupProperty.INIT_CLUSTER_VERSION);
  6. return (overriddenClusterVersion != null) ? MemberVersion.of(overriddenClusterVersion).asVersion()
  7. : node.getVersion().asVersion();
  8. }
  9. }

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

  1. private void handleGetClusterVersion(HttpGetCommand command) {
  2. String res = "{\"status\":\"${STATUS}\",\"version\":\"${VERSION}\"}";
  3. Node node = textCommandService.getNode();
  4. ClusterService clusterService = node.getClusterService();
  5. res = res.replace("${STATUS}", "success");
  6. res = res.replace("${VERSION}", clusterService.getClusterVersion().toString());
  7. command.setResponse(HttpCommand.CONTENT_TYPE_JSON, stringToBytes(res));
  8. }

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

  1. public AbstractJoiner(Node node) {
  2. this.node = node;
  3. this.logger = node.loggingService.getLogger(getClass());
  4. this.config = node.config;
  5. this.clusterService = node.getClusterService();
  6. this.clusterJoinManager = clusterService.getClusterJoinManager();
  7. this.mergeNextRunDelayMs = node.getProperties().getMillis(GroupProperty.MERGE_NEXT_RUN_DELAY_SECONDS);
  8. }

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

  1. private void resetState() {
  2. // reset node and membership state from now on this node won't be joined and won't have a master address
  3. node.reset();
  4. node.getClusterService().reset();
  5. // stop the connection-manager:
  6. // - all socket connections will be closed
  7. // - connection listening thread will stop
  8. // - no new connection will be established
  9. node.connectionManager.stop();
  10. // clear waiting operations in queue and notify invocations to retry
  11. node.nodeEngine.reset();
  12. }

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

  1. private URL newGetTaskUrl() throws IOException {
  2. GroupConfig groupConfig = instance.getConfig().getGroupConfig();
  3. Address localAddress = instance.node.getClusterService().getLocalMember().getAddress();
  4. String urlString = cleanupUrl(managementCenterUrl) + "getTask.do?member=" + localAddress.getHost()
  5. + ":" + localAddress.getPort() + "&cluster=" + encode(groupConfig.getName(), "UTF-8");
  6. return new URL(urlString);
  7. }

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

  1. private URL newGetTaskUrl() throws IOException {
  2. GroupConfig groupConfig = instance.getConfig().getGroupConfig();
  3. Address localAddress = instance.node.getClusterService().getLocalMember().getAddress();
  4. String urlString = cleanupUrl(managementCenterUrl) + "getTask.do?member=" + localAddress.getHost()
  5. + ":" + localAddress.getPort() + "&cluster=" + encode(groupConfig.getName(), "UTF-8");
  6. return new URL(urlString);
  7. }

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

  1. @Override
  2. public void run() {
  3. final NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
  4. final Node node = nodeEngine.getNode();
  5. if (node.getClusterService().isJoined()) {
  6. throw new IllegalStateException("Node is already joined but received a termination message! "
  7. + "Reason: " + failReasonMsg);
  8. }
  9. final ILogger logger = nodeEngine.getLogger("com.hazelcast.security");
  10. logger.severe("Node could not join cluster. Before join check failed node is going to shutdown now!");
  11. logger.severe("Reason of failure for node join: " + failReasonMsg);
  12. node.shutdown(true);
  13. }

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

  1. private void registerCoreServices() {
  2. logger.finest("Registering core services...");
  3. Node node = nodeEngine.getNode();
  4. registerService(ClusterServiceImpl.SERVICE_NAME, node.getClusterService());
  5. registerService(InternalPartitionService.SERVICE_NAME, node.getPartitionService());
  6. registerService(ProxyServiceImpl.SERVICE_NAME, nodeEngine.getProxyService());
  7. registerService(TransactionManagerServiceImpl.SERVICE_NAME, nodeEngine.getTransactionManagerService());
  8. registerService(ClientEngineImpl.SERVICE_NAME, node.clientEngine);
  9. registerService(QuorumServiceImpl.SERVICE_NAME, nodeEngine.getQuorumService());
  10. registerService(WanReplicationService.SERVICE_NAME, nodeEngine.getWanReplicationService());
  11. registerService(EventServiceImpl.SERVICE_NAME, nodeEngine.getEventService());
  12. }

相关文章