aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorwisberg <wisberg>2004-05-05 10:18:34 +0000
committerwisberg <wisberg>2004-05-05 10:18:34 +0000
commitbd1603312535dea0f2c6109a8b074631a3218929 (patch)
tree6bda188a74eda67d4ab20dbd3fed7f7b74d29e31 /testing
parent5f6b18be7a143c961ae1de5ffbf1aef3d249a55e (diff)
downloadaspectj-bd1603312535dea0f2c6109a8b074631a3218929.tar.gz
aspectj-bd1603312535dea0f2c6109a8b074631a3218929.zip
bug 59599 - dir-changes delay for filesystem
Diffstat (limited to 'testing')
-rw-r--r--testing/src/org/aspectj/testing/harness/bridge/DirChanges.java30
1 files changed, 29 insertions, 1 deletions
diff --git a/testing/src/org/aspectj/testing/harness/bridge/DirChanges.java b/testing/src/org/aspectj/testing/harness/bridge/DirChanges.java
index 6ec838526..d1e793289 100644
--- a/testing/src/org/aspectj/testing/harness/bridge/DirChanges.java
+++ b/testing/src/org/aspectj/testing/harness/bridge/DirChanges.java
@@ -54,7 +54,22 @@ import org.aspectj.util.LangUtil;
*/
public class DirChanges {
- private static final boolean EXISTS = true;
+ public static final String DELAY_NAME = "dir-changes.delay";
+ private static final long DELAY;
+ static {
+ long delay = 10l;
+ try {
+ delay = Long.getLong(DELAY_NAME).longValue();
+ if ((delay > 40000) || (delay < 0)) {
+ delay = 10l;
+ }
+ } catch (Throwable t) {
+ // ignore
+ }
+ DELAY = delay;
+ }
+
+ private static final boolean EXISTS = true;
final Spec spec;
@@ -110,6 +125,7 @@ public class DirChanges {
* Inspect the base dir, issue any messages for
* files not added, files not updated, and files not removed,
* and compare expected/actual files added or updated.
+ * This sleeps before checking until at least DELAY milliseconds after start.
* @throws IllegalStateException if called before start(..)
*/
public boolean end(IMessageHandler handler, File srcBaseDir) {
@@ -117,6 +133,18 @@ public class DirChanges {
if (0l == startTime) {
throw new IllegalStateException("called before start");
}
+ final long targetTime = startTime + DELAY;
+ do {
+ long curTime = System.currentTimeMillis();
+ if (curTime >= targetTime) {
+ break;
+ }
+ try {
+ Thread.sleep(targetTime-curTime);
+ } catch (InterruptedException e) {
+ break;
+ }
+ } while (true);
final IMessageHandler oldHandler = this.handler;
this.handler = handler;
try {