Core: don't listAll twice
In #6636 we switched to a default FileSwitchDirectory that made .listAll run twice on the same underlying file system directory. This fixes listAll to do a single directory listing again. Closes #9666
This commit is contained in:
parent
98aad1bcbd
commit
6867f4a3fa
|
@ -50,6 +50,13 @@ public class DefaultFsDirectoryService extends FsDirectoryService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Directory newFSDirectory(Path location, LockFactory lockFactory) throws IOException {
|
protected Directory newFSDirectory(Path location, LockFactory lockFactory) throws IOException {
|
||||||
return new FileSwitchDirectory(PRIMARY_EXTENSIONS, new MMapDirectory(location, lockFactory), new NIOFSDirectory(location, lockFactory), true);
|
final MMapDirectory mmapDir = new MMapDirectory(location, lockFactory);
|
||||||
|
return new FileSwitchDirectory(PRIMARY_EXTENSIONS, mmapDir, new NIOFSDirectory(location, lockFactory), true) {
|
||||||
|
@Override
|
||||||
|
public String[] listAll() throws IOException {
|
||||||
|
// Avoid doing listAll twice:
|
||||||
|
return mmapDir.listAll();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue