@Test public void testGroupsLoad2() throws Exception, ParseException { ClusterSubdomainAffinityAlgorithm algorithm = new ClusterSubdomainAffinityAlgorithm(); try { algorithm.loadSubclusters(groups2); } catch (Exception e) { return; } fail("Excpeted excpetion"); }
public void loadSubclusters(String subclustersString) { ConcurrentHashMap<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); if(subclustersString != null) { subclustersString = subclustersString.replaceAll(" ", ""); String[] groups = subclustersString.split("\\)\\("); for(int q=0; q<groups.length; q++) { String group = groups[q]; group = group.replaceAll("\\(", "").replaceAll("\\)",""); String[] hosts = group.split(","); LinkedList<String> hostGroupList = new LinkedList<String>(); for(String host:hosts) { if(host.length()>0) { if(hostGroupList.contains(host)) { throw new RuntimeException("Duplicate host " + host + " in " + hosts); } hostGroupList.add(host); } } for(String host:hosts) { List<String> tmp = new LinkedList<String>(hostGroupList); tmp.remove(host); map.put(host, tmp); } } } nodeToNodeGroup = map; }
ClusterSubdomainAffinityAlgorithm extends CallIDAffinityBalancerAlgorithm { public void loadSubclusters(String subclustersString) { ConcurrentHashMap<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); if(subclustersString != null) { subclustersString = subclustersString.replaceAll(" ", ""); String[] groups = subclustersString.split("\\)\\("); for(int q=0; q<groups.length; q++) { String group = groups[q]; group = group.replaceAll("\\(", "").replaceAll("\\)",""); String[] hosts = group.split(","); LinkedList<String> hostGroupList = new LinkedList<String>(); for(String host:hosts) { if(host.length()>0) { if(hostGroupList.contains(host)) { throw new RuntimeException("Duplicate host " + host + " in " + hosts); } hostGroupList.add(host); } } for(String host:hosts) { List<String> tmp = new LinkedList<String>(hostGroupList); tmp.remove(host); map.put(host, tmp); } } } nodeToNodeGroup = map; } }
ClusterSubdomainAffinityAlgorithm extends CallIDAffinityBalancerAlgorithm { public void loadSubclusters(String subclustersString) { ConcurrentHashMap<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); if(subclustersString != null) { subclustersString = subclustersString.replaceAll(" ", ""); String[] groups = subclustersString.split("\\)\\("); for(int q=0; q<groups.length; q++) { String group = groups[q]; group = group.replaceAll("\\(", "").replaceAll("\\)",""); String[] hosts = group.split(","); LinkedList<String> hostGroupList = new LinkedList<String>(); for(String host:hosts) { if(host.length()>0) { if(hostGroupList.contains(host)) { throw new RuntimeException("Duplicate host " + host + " in " + hosts); } hostGroupList.add(host); } } for(String host:hosts) { List<String> tmp = new LinkedList<String>(hostGroupList); tmp.remove(host); map.put(host, tmp); } } } nodeToNodeGroup = map; }  }
ClusterSubdomainAffinityAlgorithm extends CallIDAffinityBalancerAlgorithm { public void loadSubclusters(String subclustersString) { ConcurrentHashMap<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); if(subclustersString != null) { subclustersString = subclustersString.replaceAll(" ", ""); String[] groups = subclustersString.split("\\)\\("); for(int q=0; q<groups.length; q++) { String group = groups[q]; group = group.replaceAll("\\(", "").replaceAll("\\)",""); String[] hosts = group.split(","); LinkedList<String> hostGroupList = new LinkedList<String>(); for(String host:hosts) { if(host.length()>0) { if(hostGroupList.contains(host)) { throw new RuntimeException("Duplicate host " + host + " in " + hosts); } hostGroupList.add(host); } } for(String host:hosts) { List<String> tmp = new LinkedList<String>(hostGroupList); tmp.remove(host); map.put(host, tmp); } } } nodeToNodeGroup = map; }  void init(); void loadSubclusters(String subclustersString); String dumpSubcluster(); void configurationChanged(); }
ClusterSubdomainAffinityAlgorithm extends CallIDAffinityBalancerAlgorithm { public void loadSubclusters(String subclustersString) { ConcurrentHashMap<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); if(subclustersString != null) { subclustersString = subclustersString.replaceAll(" ", ""); String[] groups = subclustersString.split("\\)\\("); for(int q=0; q<groups.length; q++) { String group = groups[q]; group = group.replaceAll("\\(", "").replaceAll("\\)",""); String[] hosts = group.split(","); LinkedList<String> hostGroupList = new LinkedList<String>(); for(String host:hosts) { if(host.length()>0) { if(hostGroupList.contains(host)) { throw new RuntimeException("Duplicate host " + host + " in " + hosts); } hostGroupList.add(host); } } for(String host:hosts) { List<String> tmp = new LinkedList<String>(hostGroupList); tmp.remove(host); map.put(host, tmp); } } } nodeToNodeGroup = map; }  void init(); void loadSubclusters(String subclustersString); String dumpSubcluster(); void configurationChanged();  }