mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
Renamed a bunch of lock variables.
"synchLock" will become confusing when we have lots of objects with "sync" in the name.
This commit is contained in:
@@ -9,9 +9,9 @@ import org.briarproject.api.lifecycle.ShutdownManager;
|
||||
|
||||
class ShutdownManagerImpl implements ShutdownManager {
|
||||
|
||||
private final Lock synchLock = new ReentrantLock();
|
||||
private final Lock lock = new ReentrantLock();
|
||||
|
||||
// The following are locking: synchLock
|
||||
// The following are locking: lock
|
||||
protected final Map<Integer, Thread> hooks;
|
||||
private int nextHandle = 0;
|
||||
|
||||
@@ -20,7 +20,7 @@ class ShutdownManagerImpl implements ShutdownManager {
|
||||
}
|
||||
|
||||
public int addShutdownHook(Runnable r) {
|
||||
synchLock.lock();
|
||||
lock.lock();
|
||||
try {
|
||||
int handle = nextHandle++;
|
||||
Thread hook = createThread(r);
|
||||
@@ -28,7 +28,7 @@ class ShutdownManagerImpl implements ShutdownManager {
|
||||
Runtime.getRuntime().addShutdownHook(hook);
|
||||
return handle;
|
||||
} finally {
|
||||
synchLock.unlock();
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,13 +38,13 @@ class ShutdownManagerImpl implements ShutdownManager {
|
||||
}
|
||||
|
||||
public boolean removeShutdownHook(int handle) {
|
||||
synchLock.lock();
|
||||
lock.lock();
|
||||
try {
|
||||
Thread hook = hooks.remove(handle);
|
||||
if (hook == null) return false;
|
||||
else return Runtime.getRuntime().removeShutdownHook(hook);
|
||||
} finally {
|
||||
synchLock.unlock();
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user