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:
akwizgran
2015-12-03 16:39:53 +00:00
parent 4f59491c9f
commit 8529c976c2
18 changed files with 180 additions and 179 deletions

View File

@@ -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();
}
}