[spotbugs] FileReftableDatabase: extract lock to local variable
This fixes UL_UNRELEASED_LOCK_EXCEPTION_PATH raised by spotbugs in #compactFully. Change-Id: I370578ad9a027c5c9709d60a1dfafdac0cfca908 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
39cbc574d1
commit
fa0e77e8f9
|
@ -22,6 +22,7 @@
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
import java.util.concurrent.locks.Lock;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -107,12 +108,13 @@ public boolean hasFastTipsWithSha1() throws IOException {
|
||||||
* @throws IOException on I/O errors
|
* @throws IOException on I/O errors
|
||||||
*/
|
*/
|
||||||
public void compactFully() throws IOException {
|
public void compactFully() throws IOException {
|
||||||
reftableDatabase.getLock().lock();
|
Lock l = reftableDatabase.getLock();
|
||||||
|
l.lock();
|
||||||
try {
|
try {
|
||||||
reftableStack.compactFully();
|
reftableStack.compactFully();
|
||||||
reftableDatabase.clearCache();
|
reftableDatabase.clearCache();
|
||||||
} finally {
|
} finally {
|
||||||
reftableDatabase.getLock().unlock();
|
l.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue