From de6699791d5ce81399cccd0f0d258156cfec2b00 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 11 Jan 2012 20:30:13 +0100 Subject: [PATCH] IDEA-79783 Perforce: revert for couple of directories rename marks file as unversioned --- .../vcs/changes/UpdateRequestsQueue.java | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdateRequestsQueue.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdateRequestsQueue.java index 8719e2966b01..93852a239601 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdateRequestsQueue.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdateRequestsQueue.java @@ -140,23 +140,32 @@ public class UpdateRequestsQueue { @TestOnly public void waitUntilRefreshed() { - final Semaphore semaphore = new Semaphore(); - semaphore.down(); - synchronized (myLock) { - final Runnable runnable = new Runnable() { - @Override - public void run() { - semaphore.up(); + while (true) { + final Semaphore semaphore = new Semaphore(); + semaphore.down(); + synchronized (myLock) { + final Runnable runnable = new Runnable() { + @Override + public void run() { + semaphore.up(); + } + }; + if (myRequestSubmitted && !myStopped) { + myWaitingUpdateCompletionQueue.add(runnable); + } else { + runnable.run(); + } + } + if (!semaphore.waitFor(10000)) { + LOG.error("Too long VCS update"); + return; + } + + synchronized (myLock) { + if (!myRequestSubmitted || myStopped) { + return; } - }; - if (myRequestSubmitted && !myStopped) { - myWaitingUpdateCompletionQueue.add(runnable); - } else { - runnable.run(); } - } - if (!semaphore.waitFor(10000)) { - LOG.error("Too long VCS update"); } }