Revert lock variable rename for clarity

This commit is contained in:
Abraham Kiggundu
2015-01-07 00:37:28 +03:00
parent 2933f1a874
commit be2a92d6c2

View File

@@ -22,8 +22,8 @@ class PollingRemovableDriveMonitor implements RemovableDriveMonitor, Runnable {
private volatile boolean running = false; private volatile boolean running = false;
private volatile Callback callback = null; private volatile Callback callback = null;
private final Lock synchLock = new ReentrantLock(); private final Lock pollingLock = new ReentrantLock();
private final Condition stopPolling = synchLock.newCondition(); private final Condition stopPolling = pollingLock.newCondition();
public PollingRemovableDriveMonitor(Executor ioExecutor, public PollingRemovableDriveMonitor(Executor ioExecutor,
@@ -41,12 +41,12 @@ class PollingRemovableDriveMonitor implements RemovableDriveMonitor, Runnable {
public void stop() throws IOException { public void stop() throws IOException {
running = false; running = false;
synchLock.lock(); pollingLock.lock();
try { try {
stopPolling.signalAll(); stopPolling.signalAll();
} }
finally { finally {
synchLock.unlock(); pollingLock.unlock();
} }
} }
@@ -54,12 +54,12 @@ class PollingRemovableDriveMonitor implements RemovableDriveMonitor, Runnable {
try { try {
Collection<File> drives = finder.findRemovableDrives(); Collection<File> drives = finder.findRemovableDrives();
while(running) { while(running) {
synchLock.lock(); pollingLock.lock();
try { try {
stopPolling.await(pollingInterval, TimeUnit.MILLISECONDS); stopPolling.await(pollingInterval, TimeUnit.MILLISECONDS);
} }
finally{ finally{
synchLock.unlock(); pollingLock.unlock();
} }
if(!running) return; if(!running) return;
Collection<File> newDrives = finder.findRemovableDrives(); Collection<File> newDrives = finder.findRemovableDrives();