diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java index 3e31ae60d0..62b67da6f8 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java @@ -37,6 +37,8 @@ public class CDOQueryQueue<E> implements Queue<E>, Closeable private boolean closed; + private Object closeLock = new Object(); + public CDOQueryQueue() { } @@ -48,9 +50,9 @@ public class CDOQueryQueue<E> implements Queue<E>, Closeable public void close() { - synchronized (this) + synchronized (closeLock) { - if (!isClosed()) + if (!closed) { closed = true; queue.add(QUEUE_CLOSED); @@ -60,8 +62,11 @@ public class CDOQueryQueue<E> implements Queue<E>, Closeable public boolean isClosed() { + synchronized (closeLock) + { return closed; } + } public boolean add(E e) { @@ -352,7 +357,7 @@ public class CDOQueryQueue<E> implements Queue<E>, Closeable { try { - synchronized (CDOQueryQueue.this) + synchronized (closeLock) { if (CDOQueryQueue.this.isEmpty() && CDOQueryQueue.this.isClosed()) { |