public static MemberGroupFactory newMemberGroupFactory(PartitionGroupConfig partitionGroupConfig, DiscoveryService discoveryService) { PartitionGroupConfig.MemberGroupType memberGroupType; if (partitionGroupConfig == null || !partitionGroupConfig.isEnabled()) { memberGroupType = PartitionGroupConfig.MemberGroupType.PER_MEMBER; } else { memberGroupType = partitionGroupConfig.getGroupType(); } switch (memberGroupType) { case HOST_AWARE: return new HostAwareMemberGroupFactory(); case CUSTOM: return new ConfigMemberGroupFactory(partitionGroupConfig.getMemberGroupConfigs()); case PER_MEMBER: return new SingleMemberGroupFactory(); case ZONE_AWARE: return new ZoneAwareMemberGroupFactory(); case SPI: return new SPIAwareMemberGroupFactory(discoveryService); default: throw new RuntimeException("Unknown MemberGroupType:" + memberGroupType); } } }
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; } } }
public static MemberGroupFactory newMemberGroupFactory(PartitionGroupConfig partitionGroupConfig, DiscoveryService discoveryService) { PartitionGroupConfig.MemberGroupType memberGroupType; if (partitionGroupConfig == null || !partitionGroupConfig.isEnabled()) { memberGroupType = PartitionGroupConfig.MemberGroupType.PER_MEMBER; } else { memberGroupType = partitionGroupConfig.getGroupType(); } switch (memberGroupType) { case HOST_AWARE: return new HostAwareMemberGroupFactory(); case CUSTOM: return new ConfigMemberGroupFactory(partitionGroupConfig.getMemberGroupConfigs()); case PER_MEMBER: return new SingleMemberGroupFactory(); case ZONE_AWARE: return new ZoneAwareMemberGroupFactory(); case SPI: return new SPIAwareMemberGroupFactory(discoveryService); default: throw new RuntimeException("Unknown MemberGroupType:" + memberGroupType); } } }
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; } } }
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(); }
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(); }