From d69a1829c19a918725eb22ba6b73e7e62f387a09 Mon Sep 17 00:00:00 2001 From: Magesh Umasankar Date: Thu, 6 Dec 2001 14:33:40 +0000 Subject: [PATCH] Ensure maxWaitMIllis and checkEveryMillis results in proper values irrespective of the order in which the setter methods are called. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270079 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/WaitFor.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/WaitFor.java b/src/main/org/apache/tools/ant/taskdefs/WaitFor.java index 1e0d0b2c4..d88b43487 100644 --- a/src/main/org/apache/tools/ant/taskdefs/WaitFor.java +++ b/src/main/org/apache/tools/ant/taskdefs/WaitFor.java @@ -85,7 +85,9 @@ import java.util.Hashtable; public class WaitFor extends ConditionBase { private long maxWaitMillis = 1000l * 60l * 3l; // default max wait time + private long maxWaitMultiplier = 1l; private long checkEveryMillis = 500l; + private long checkEveryMultiplier = 1l; /** * Set the maximum length of time to wait @@ -98,7 +100,7 @@ public class WaitFor extends ConditionBase { * Set the max wait time unit */ public void setMaxWaitUnit(Unit unit) { - maxWaitMillis *= unit.getMultiplier(); + maxWaitMultiplier = unit.getMultiplier(); } /** @@ -112,7 +114,7 @@ public class WaitFor extends ConditionBase { * Set the check every time unit */ public void setCheckEveryUnit(Unit unit) { - checkEveryMillis *= unit.getMultiplier(); + checkEveryMultiplier = unit.getMultiplier(); } /** @@ -128,6 +130,8 @@ public class WaitFor extends ConditionBase { } Condition c = (Condition) getConditions().nextElement(); + maxWaitMillis *= maxWaitMultiplier; + checkEveryMillis *= checkEveryMultiplier; long start = System.currentTimeMillis(); long end = start + maxWaitMillis;