/** * Get the next subdirectory within the block pool slice. * * @return The next subdirectory within the block pool slice, or * null if there are no more. */ private String getNextSubDir(String prev, File dir) throws IOException { List<String> children = fileIoProvider.listDirectory( FsVolumeImpl.this, dir, SubdirFilter.INSTANCE); cache = null; cacheMs = 0; if (children.size() == 0) { LOG.trace("getNextSubDir({}, {}): no subdirectories found in {}", storageID, bpid, dir.getAbsolutePath()); return null; } Collections.sort(children); String nextSubDir = nextSorted(children, prev); if (nextSubDir == null) { LOG.trace("getNextSubDir({}, {}): no more subdirectories found in {}", storageID, bpid, dir.getAbsolutePath()); } else { LOG.trace("getNextSubDir({}, {}): picking next subdirectory {} " + "within {}", storageID, bpid, nextSubDir, dir.getAbsolutePath()); } return nextSubDir; }
List<String> entries = getSubdirEntries(); if (entries != null) { state.curEntry = nextSorted(entries, state.curEntry); if (state.curEntry == null) { LOG.trace("nextBlock({}, {}): advancing from {} to next " +
/** * Get the next subdirectory within the block pool slice. * * @return The next subdirectory within the block pool slice, or * null if there are no more. */ private String getNextSubDir(String prev, File dir) throws IOException { List<String> children = IOUtils.listDirectory(dir, SubdirFilter.INSTANCE); cache = null; cacheMs = 0; if (children.size() == 0) { LOG.trace("getNextSubDir({}, {}): no subdirectories found in {}", storageID, bpid, dir.getAbsolutePath()); return null; } Collections.sort(children); String nextSubDir = nextSorted(children, prev); if (nextSubDir == null) { LOG.trace("getNextSubDir({}, {}): no more subdirectories found in {}", storageID, bpid, dir.getAbsolutePath()); } else { LOG.trace("getNextSubDir({}, {}): picking next subdirectory {} " + "within {}", storageID, bpid, nextSubDir, dir.getAbsolutePath()); } return nextSubDir; }
/** * Get the next subdirectory within the block pool slice. * * @return The next subdirectory within the block pool slice, or * null if there are no more. */ private String getNextSubDir(String prev, File dir) throws IOException { List<String> children = IOUtils.listDirectory(dir, SubdirFilter.INSTANCE); cache = null; cacheMs = 0; if (children.size() == 0) { LOG.trace("getNextSubDir({}, {}): no subdirectories found in {}", storageID, bpid, dir.getAbsolutePath()); return null; } Collections.sort(children); String nextSubDir = nextSorted(children, prev); if (nextSubDir == null) { LOG.trace("getNextSubDir({}, {}): no more subdirectories found in {}", storageID, bpid, dir.getAbsolutePath()); } else { LOG.trace("getNextSubDir({}, {}): picking next subdirectory {} " + "within {}", storageID, bpid, nextSubDir, dir.getAbsolutePath()); } return nextSubDir; }
@Test(timeout=120000) public void testNextSorted() throws Exception { List<String> arr = new LinkedList<String>(); arr.add("1"); arr.add("3"); arr.add("5"); arr.add("7"); Assert.assertEquals("3", FsVolumeImpl.nextSorted(arr, "2")); Assert.assertEquals("3", FsVolumeImpl.nextSorted(arr, "1")); Assert.assertEquals("1", FsVolumeImpl.nextSorted(arr, "")); Assert.assertEquals("1", FsVolumeImpl.nextSorted(arr, null)); Assert.assertEquals(null, FsVolumeImpl.nextSorted(arr, "9")); }
List<String> entries = getSubdirEntries(); if (entries != null) { state.curEntry = nextSorted(entries, state.curEntry); if (state.curEntry == null) { LOG.trace("nextBlock({}, {}): advancing from {} to next " +
List<String> entries = getSubdirEntries(); if (entries != null) { state.curEntry = nextSorted(entries, state.curEntry); if (state.curEntry == null) { LOG.trace("nextBlock({}, {}): advancing from {} to next " +