Browse Source

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
master
Magesh Umasankar 23 years ago
parent
commit
d69a1829c1
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      src/main/org/apache/tools/ant/taskdefs/WaitFor.java

+ 6
- 2
src/main/org/apache/tools/ant/taskdefs/WaitFor.java View File

@@ -85,7 +85,9 @@ import java.util.Hashtable;


public class WaitFor extends ConditionBase { public class WaitFor extends ConditionBase {
private long maxWaitMillis = 1000l * 60l * 3l; // default max wait time private long maxWaitMillis = 1000l * 60l * 3l; // default max wait time
private long maxWaitMultiplier = 1l;
private long checkEveryMillis = 500l; private long checkEveryMillis = 500l;
private long checkEveryMultiplier = 1l;


/** /**
* Set the maximum length of time to wait * Set the maximum length of time to wait
@@ -98,7 +100,7 @@ public class WaitFor extends ConditionBase {
* Set the max wait time unit * Set the max wait time unit
*/ */
public void setMaxWaitUnit(Unit 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 * Set the check every time unit
*/ */
public void setCheckEveryUnit(Unit 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(); Condition c = (Condition) getConditions().nextElement();


maxWaitMillis *= maxWaitMultiplier;
checkEveryMillis *= checkEveryMultiplier;
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
long end = start + maxWaitMillis; long end = start + maxWaitMillis;




Loading…
Cancel
Save