use of com.hazelcast.config.MemberGroupConfig in project hazelcast by hazelcast.
the class MemberGroupFactoryTest method createMemberGroupConfigs.
private Collection<MemberGroupConfig> createMemberGroupConfigs() {
Collection<MemberGroupConfig> groupConfigs = new HashSet<MemberGroupConfig>();
MemberGroupConfig group1 = new MemberGroupConfig();
group1.addInterface("192.168.*.*");
MemberGroupConfig group2 = new MemberGroupConfig();
group2.addInterface("172.16.*.*");
MemberGroupConfig group3 = new MemberGroupConfig();
group3.addInterface("*.hazelcast.com");
MemberGroupConfig group4 = new MemberGroupConfig();
group4.addInterface("www.hazelcast.org");
groupConfigs.add(group1);
groupConfigs.add(group2);
groupConfigs.add(group3);
groupConfigs.add(group4);
return groupConfigs;
}
use of com.hazelcast.config.MemberGroupConfig in project hazelcast by hazelcast.
the class TestFullApplicationContext method testPartitionGroupConfig.
@Test
public void testPartitionGroupConfig() {
PartitionGroupConfig pgc = config.getPartitionGroupConfig();
assertFalse(pgc.isEnabled());
assertEquals(PartitionGroupConfig.MemberGroupType.CUSTOM, pgc.getGroupType());
assertEquals(2, pgc.getMemberGroupConfigs().size());
for (MemberGroupConfig mgc : pgc.getMemberGroupConfigs()) {
assertEquals(2, mgc.getInterfaces().size());
}
}
use of com.hazelcast.config.MemberGroupConfig in project hazelcast by hazelcast.
the class ConfigMemberGroupFactory method createInternalMemberGroups.
@Override
protected Set<MemberGroup> createInternalMemberGroups(Collection<? extends Member> members) {
Map<Integer, MemberGroup> memberGroups = new HashMap<Integer, MemberGroup>();
for (Member member : members) {
String host = ((MemberImpl) member).getAddress().getHost();
for (Entry<Integer, MemberGroupConfig> entry : memberGroupConfigMap.entrySet()) {
Collection<String> interfaces = entry.getValue().getInterfaces();
boolean match;
if (AddressUtil.isIpAddress(host)) {
match = AddressUtil.matchAnyInterface(host, interfaces);
} else {
match = AddressUtil.matchAnyDomain(host, interfaces);
}
if (match) {
MemberGroup group = memberGroups.get(entry.getKey());
if (group == null) {
group = new DefaultMemberGroup();
memberGroups.put(entry.getKey(), group);
}
group.addMember(member);
break;
}
}
}
return new HashSet<MemberGroup>(memberGroups.values());
}
use of com.hazelcast.config.MemberGroupConfig in project hazelcast by hazelcast.
the class YamlMemberDomConfigProcessor method handleMemberGroup.
@Override
protected void handleMemberGroup(Node node, Config config) {
for (Node memberGroupNode : childElements(node)) {
MemberGroupConfig memberGroupConfig = new MemberGroupConfig();
for (Node interfacesNode : childElements(memberGroupNode)) {
memberGroupConfig.addInterface(interfacesNode.getNodeValue().trim());
}
config.getPartitionGroupConfig().addMemberGroupConfig(memberGroupConfig);
}
}
use of com.hazelcast.config.MemberGroupConfig in project hazelcast by hazelcast.
the class LocalMapStatsMultipleNodeTest method createConfig.
private Config createConfig(String mapName, String[] firstGroup, String[] secondGroup) {
final MemberGroupConfig firstGroupConfig = createGroupConfig(firstGroup);
final MemberGroupConfig secondGroupConfig = createGroupConfig(secondGroup);
Config config = getConfig();
config.getPartitionGroupConfig().setEnabled(true).setGroupType(PartitionGroupConfig.MemberGroupType.CUSTOM);
config.getPartitionGroupConfig().addMemberGroupConfig(firstGroupConfig);
config.getPartitionGroupConfig().addMemberGroupConfig(secondGroupConfig);
config.getNetworkConfig().getInterfaces().addInterface("127.0.0.*");
config.getMapConfig(mapName).setBackupCount(2);
return config;
}
Aggregations