@Test public void testNodeGroups() throws Exception { assertEquals(3, cluster.getNumOfRacks()); assertTrue(cluster.isOnSameNodeGroup(dataNodes[0], dataNodes[1])); assertFalse(cluster.isOnSameNodeGroup(dataNodes[1], dataNodes[2])); assertFalse(cluster.isOnSameNodeGroup(dataNodes[2], dataNodes[3])); assertTrue(cluster.isOnSameNodeGroup(dataNodes[3], dataNodes[4])); assertFalse(cluster.isOnSameNodeGroup(dataNodes[4], dataNodes[5])); assertFalse(cluster.isOnSameNodeGroup(dataNodes[5], dataNodes[6])); assertFalse(cluster.isOnSameNodeGroup(dataNodes[6], dataNodes[7])); }
@Override public boolean isOnSameNodeGroup(Node node1, Node node2) { if (node1 == null || node2 == null) { return false; } netlock.readLock().lock(); try { return isSameParents(node1, node2); } finally { netlock.readLock().unlock(); } }
NetworkTopologyWithNodeGroup extends NetworkTopology { @Override public boolean isOnSameNodeGroup(Node node1, Node node2) { if (node1 == null || node2 == null) { return false; } netlock.readLock().lock(); try { return isSameParents(node1, node2); } finally { netlock.readLock().unlock(); } } }
NetworkTopologyWithNodeGroup extends NetworkTopology { @Override public boolean isOnSameNodeGroup(Node node1, Node node2) { if (node1 == null || node2 == null) { return false; } netlock.readLock().lock(); try { return isSameParents(node1, node2); } finally { netlock.readLock().unlock(); } } NetworkTopologyWithNodeGroup(); }
NetworkTopologyWithNodeGroup extends NetworkTopology { @Override public boolean isOnSameNodeGroup(Node node1, Node node2) { if (node1 == null || node2 == null) { return false; } netlock.readLock().lock(); try { return isSameParents(node1, node2); } finally { netlock.readLock().unlock(); } } NetworkTopologyWithNodeGroup(); @Override String getRack(String loc); String getNodeGroup(String loc); @Override boolean isOnSameRack( Node node1,  Node node2); @Override boolean isOnSameNodeGroup(Node node1, Node node2); @Override boolean isNodeGroupAware(); @Override void add(Node node); @Override void remove(Node node); @Override void sortByDistance(Node reader, Node[] nodes, int activeLen,
      long seed, boolean randomizeBlockLocationsPerBlock); }
NetworkTopologyWithNodeGroup extends NetworkTopology { @Override public boolean isOnSameNodeGroup(Node node1, Node node2) { if (node1 == null || node2 == null) { return false; } netlock.readLock().lock(); try { return isSameParents(node1, node2); } finally { netlock.readLock().unlock(); } } NetworkTopologyWithNodeGroup(); @Override String getRack(String loc); String getNodeGroup(String loc); @Override boolean isOnSameRack( Node node1,  Node node2); @Override boolean isOnSameNodeGroup(Node node1, Node node2); @Override boolean isNodeGroupAware(); @Override void add(Node node); @Override void remove(Node node); @Override void sortByDistance(Node reader, Node[] nodes, int activeLen,
      long seed, boolean randomizeBlockLocationsPerBlock); final static String DEFAULT_NODEGROUP; }