Store#close() swallows any `IOException`. Relates #39030
This commit is contained in:
parent
934946a232
commit
782f873165
|
@ -87,6 +87,7 @@ import java.io.FileNotFoundException;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
|
@ -416,16 +417,15 @@ public class Store extends AbstractIndexShardComponent implements Closeable, Ref
|
|||
}
|
||||
|
||||
private void closeInternal() {
|
||||
try {
|
||||
// Leverage try-with-resources to close the shard lock for us
|
||||
try (Closeable c = shardLock) {
|
||||
try {
|
||||
directory.innerClose(); // this closes the distributorDirectory as well
|
||||
} finally {
|
||||
onClose.accept(shardLock);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.debug("failed to close directory", e);
|
||||
} finally {
|
||||
IOUtils.closeWhileHandlingException(shardLock);
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue