Author: scabanovich
Date: 2011-07-21 16:13:13 -0400 (Thu, 21 Jul 2011)
New Revision: 33112
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java
Log:
JBIDE-9380
https://issues.jboss.org/browse/JBIDE-9380
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java 2011-07-21
19:52:01 UTC (rev 33111)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java 2011-07-21
20:13:13 UTC (rev 33112)
@@ -425,10 +425,36 @@
} finally {
updateLock--;
unsynchronized = null;
+ synchronized (this) {
+ this.notifyAll();
+ }
}
return true;
}
-
+
+ /**
+ * Returns true if thread had to wait.
+ * @return
+ */
+ public long waitForUpdate() {
+ if(updateLock == 0) {
+ return 0;
+ }
+ long t = System.currentTimeMillis();
+ long dt = 0;
+ while(updateLock > 0 && dt < 10000) {
+ synchronized(this) {
+ try {
+ this.wait(100);
+ } catch (InterruptedException e) {
+ return dt;
+ }
+ }
+ dt = System.currentTimeMillis() - t;
+ }
+ return dt;
+ }
+
protected File getChildIOFile(XModelObject o) {
String s = FileAnyImpl.toFileName(o);
File f = (File)o.getObject("file"); //for links //$NON-NLS-1$