Simplify FrozenEngine#getReader (#39539)
We really don’t need a try/finally in this method.
This commit is contained in:
parent
7da62d3b79
commit
3591da6ff8
|
@ -186,20 +186,11 @@ public final class FrozenEngine extends ReadOnlyEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressForbidden(reason = "we manage references explicitly here")
|
@SuppressForbidden(reason = "we manage references explicitly here")
|
||||||
private synchronized DirectoryReader getReader() throws IOException {
|
private synchronized DirectoryReader getReader() {
|
||||||
DirectoryReader reader = null;
|
if (lastOpenedReader != null && lastOpenedReader.tryIncRef()) {
|
||||||
boolean success = false;
|
return lastOpenedReader;
|
||||||
try {
|
|
||||||
if (lastOpenedReader != null && lastOpenedReader.tryIncRef()) {
|
|
||||||
reader = lastOpenedReader;
|
|
||||||
}
|
|
||||||
success = true;
|
|
||||||
return reader;
|
|
||||||
} finally {
|
|
||||||
if (success == false) {
|
|
||||||
IOUtils.close(reader);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue