/** * this method gets the count of nodes and the bytes under a subtree * * @param path the path to be used * @param bytes the long bytes * @param count the int count */ private void getCounts(String path, Counts counts) { DataNode node = getNode(path); if (node == null) { return; } String[] children = null; synchronized (node) { children = node.children.toArray(new String[node.children.size()]); } // add itself counts.count += 1; counts.bytes += (long) node.data.length; if (children.length == 0) { return; } for (String child : children) { getCounts(path + "/" + child, counts); } }