com.hazelcast.config.Config.getPartitionGroupConfig()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(171)

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

Config.getPartitionGroupConfig介绍

[英]Returns the partition group configuration for this hazelcast instance. The partition group configuration defines how partitions are mapped to members.
[中]返回此hazelcast实例的分区组配置。分区组配置定义如何将分区映射到成员。

代码示例

代码示例来源:origin: SonarSource/sonarqube

joinConfig.getTcpIpConfig().setMembers(requireNonNull(members, "Members are missing"));
config.getPartitionGroupConfig().setEnabled(false);

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

@Override
public PartitionGroupConfig getPartitionGroupConfig() {
  return staticConfig.getPartitionGroupConfig();
}

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

@Override
public PartitionGroupConfig getPartitionGroupConfig() {
  return staticConfig.getPartitionGroupConfig();
}

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

private void handlePartitionGroup(Node node) {
  NamedNodeMap attributes = node.getAttributes();
  Node enabledNode = attributes.getNamedItem("enabled");
  boolean enabled = enabledNode != null && getBooleanValue(getTextContent(enabledNode));
  config.getPartitionGroupConfig().setEnabled(enabled);
  Node groupTypeNode = attributes.getNamedItem("group-type");
  PartitionGroupConfig.MemberGroupType groupType = groupTypeNode != null
      ? PartitionGroupConfig.MemberGroupType.valueOf(upperCaseInternal(getTextContent(groupTypeNode)))
      : PartitionGroupConfig.MemberGroupType.PER_MEMBER;
  config.getPartitionGroupConfig().setGroupType(groupType);
  for (Node child : childElements(node)) {
    if ("member-group".equals(cleanNodeName(child))) {
      handleMemberGroup(child);
    }
  }
}

代码示例来源:origin: org.apereo.cas/cas-server-support-hazelcast-core

private static Config finalizeConfig(final Config config, final BaseHazelcastProperties hz) {
  if (StringUtils.hasText(hz.getCluster().getPartitionMemberGroupType())) {
    val partitionGroupConfig = config.getPartitionGroupConfig();
    val type = PartitionGroupConfig.MemberGroupType.valueOf(
      hz.getCluster().getPartitionMemberGroupType().toUpperCase());
    LOGGER.debug("Using partition member group type [{}]", type);
    partitionGroupConfig.setEnabled(true).setGroupType(type);
  }
  return config;
}

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

private void handlePartitionGroup(Node node) {
  NamedNodeMap attributes = node.getAttributes();
  Node enabledNode = attributes.getNamedItem("enabled");
  boolean enabled = enabledNode != null && getBooleanValue(getTextContent(enabledNode));
  config.getPartitionGroupConfig().setEnabled(enabled);
  Node groupTypeNode = attributes.getNamedItem("group-type");
  MemberGroupType groupType = groupTypeNode != null
      ? MemberGroupType.valueOf(upperCaseInternal(getTextContent(groupTypeNode)))
      : MemberGroupType.PER_MEMBER;
  config.getPartitionGroupConfig().setGroupType(groupType);
  for (Node child : childElements(node)) {
    if ("member-group".equals(cleanNodeName(child))) {
      handleMemberGroup(child);
    }
  }
}

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

private void handleMemberGroup(Node node) {
  MemberGroupConfig memberGroupConfig = new MemberGroupConfig();
  for (Node child : childElements(node)) {
    if ("interface".equals(cleanNodeName(child))) {
      String value = getTextContent(child);
      memberGroupConfig.addInterface(value);
    }
  }
  config.getPartitionGroupConfig().addMemberGroupConfig(memberGroupConfig);
}

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

private void handleMemberGroup(Node node) {
  MemberGroupConfig memberGroupConfig = new MemberGroupConfig();
  for (Node child : childElements(node)) {
    if ("interface".equals(cleanNodeName(child))) {
      String value = getTextContent(child);
      memberGroupConfig.addInterface(value);
    }
  }
  config.getPartitionGroupConfig().addMemberGroupConfig(memberGroupConfig);
}

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

public PartitionStateManager(Node node, InternalPartitionServiceImpl partitionService, PartitionListener listener) {
  this.node = node;
  this.logger = node.getLogger(getClass());
  this.partitionService = partitionService;
  partitionCount = partitionService.getPartitionCount();
  this.partitions = new InternalPartitionImpl[partitionCount];
  Address thisAddress = node.getThisAddress();
  for (int i = 0; i < partitionCount; i++) {
    this.partitions[i] = new InternalPartitionImpl(i, listener, thisAddress);
  }
  memberGroupFactory = MemberGroupFactoryFactory.newMemberGroupFactory(node.getConfig().getPartitionGroupConfig(),
      node.getDiscoveryService());
  partitionStateGenerator = new PartitionStateGeneratorImpl();
}

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

public PartitionStateManager(Node node, InternalPartitionServiceImpl partitionService, PartitionListener listener) {
  this.node = node;
  this.logger = node.getLogger(getClass());
  this.partitionService = partitionService;
  this.partitionCount = partitionService.getPartitionCount();
  this.partitions = new InternalPartitionImpl[partitionCount];
  PartitionReplica localReplica = PartitionReplica.from(node.getLocalMember());
  for (int i = 0; i < partitionCount; i++) {
    this.partitions[i] = new InternalPartitionImpl(i, listener, localReplica);
  }
  memberGroupFactory = MemberGroupFactoryFactory.newMemberGroupFactory(node.getConfig().getPartitionGroupConfig(),
      node.getDiscoveryService());
  partitionStateGenerator = new PartitionStateGeneratorImpl();
}

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

public ConfigCheck(Config config, String joinerType) {
  this.joinerType = joinerType;
  // Copying all properties relevant for checking
  properties.put(PARTITION_COUNT.getName(), config.getProperty(PARTITION_COUNT.getName()));
  properties.put(APPLICATION_VALIDATION_TOKEN.getName(), config.getProperty(APPLICATION_VALIDATION_TOKEN.getName()));
  // Copying group-config settings
  GroupConfig groupConfig = config.getGroupConfig();
  if (groupConfig != null) {
    this.groupName = groupConfig.getName();
  }
  // Partition-group settings
  final PartitionGroupConfig partitionGroupConfig = config.getPartitionGroupConfig();
  if (partitionGroupConfig != null) {
    partitionGroupEnabled = partitionGroupConfig.isEnabled();
    if (partitionGroupEnabled) {
      memberGroupType = partitionGroupConfig.getGroupType();
    } else {
      memberGroupType = PartitionGroupConfig.MemberGroupType.PER_MEMBER;
    }
  }
}

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

public ConfigCheck(Config config, String joinerType) {
  this.joinerType = joinerType;
  // Copying all properties relevant for checking
  properties.put(PARTITION_COUNT.getName(), config.getProperty(PARTITION_COUNT.getName()));
  properties.put(APPLICATION_VALIDATION_TOKEN.getName(), config.getProperty(APPLICATION_VALIDATION_TOKEN.getName()));
  // Copying group-config settings
  GroupConfig groupConfig = config.getGroupConfig();
  if (groupConfig != null) {
    this.groupName = groupConfig.getName();
  }
  // Partition-group settings
  final PartitionGroupConfig partitionGroupConfig = config.getPartitionGroupConfig();
  if (partitionGroupConfig != null) {
    partitionGroupEnabled = partitionGroupConfig.isEnabled();
    if (partitionGroupEnabled) {
      memberGroupType = partitionGroupConfig.getGroupType();
    } else {
      memberGroupType = PartitionGroupConfig.MemberGroupType.PER_MEMBER;
    }
  }
}

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

private static void partitionGroupXmlGenerator(XmlGenerator gen, Config config) {
  PartitionGroupConfig pg = config.getPartitionGroupConfig();
  if (pg == null) {
    return;
  }
  gen.open("partition-group", "enabled", pg.isEnabled(), "group-type", pg.getGroupType());
  Collection<MemberGroupConfig> configs = pg.getMemberGroupConfigs();
  if (CollectionUtil.isNotEmpty(configs)) {
    for (MemberGroupConfig mgConfig : configs) {
      gen.open("member-group");
      for (String iface : mgConfig.getInterfaces()) {
        gen.node("interface", iface);
      }
      gen.close();
    }
  }
  gen.close();
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

config.getPartitionGroupConfig()
    .setEnabled(true)
    .setGroupType(ZONE_AWARE);

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

private static void partitionGroupXmlGenerator(XmlGenerator gen, Config config) {
  PartitionGroupConfig pg = config.getPartitionGroupConfig();
  if (pg == null) {
    return;
  }
  gen.open("partition-group", "enabled", pg.isEnabled(), "group-type", pg.getGroupType());
  Collection<MemberGroupConfig> configs = pg.getMemberGroupConfigs();
  if (CollectionUtil.isNotEmpty(configs)) {
    for (MemberGroupConfig mgConfig : configs) {
      gen.open("member-group");
      for (String iface : mgConfig.getInterfaces()) {
        gen.node("interface", iface);
      }
      gen.close();
    }
  }
  gen.close();
}

相关文章

Config类方法