Clean up shutdown of async queue

This commit is contained in:
Mike Primm 2011-10-08 12:24:27 +08:00 committed by mikeprimm
parent f335641eab
commit 1253ac2e6a

View File

@ -36,12 +36,16 @@ public class AsynchronousQueue<T> {
return true; return true;
} }
private T pop() throws InterruptedException { private T pop() {
T t = queue.take(); try {
synchronized (lock) { T t = queue.take();
set.remove(t); synchronized (lock) {
set.remove(t);
}
return t;
} catch (InterruptedException ix) {
return null;
} }
return t;
} }
public boolean remove(T t) { public boolean remove(T t) {