## org.apache.tools.ant.taskdefs
Class WaitFor

    java.lang.Object
      |
      +--org.apache.tools.ant.ProjectComponent
            |
            +--org.apache.tools.ant.taskdefs.condition.ConditionBase
                  |
                  +--org.apache.tools.ant.taskdefs.WaitFor

public class WaitFor
extends ConditionBase

Wait for an external event to occur. Wait for an external process to start or to complete some task. This is useful with the `parallel` task to synchronize the execution of tests with server startup. The following attributes can be specified on a waitfor task:

- maxwait - maximum length of time to wait before giving up
- maxwaitunit - The unit to be used to interpret maxwait attribute
- checkevery - amount of time to sleep between each check
- checkeveryunit - The unit to be used to interpret checkevery attribute
- timeoutproperty - name of a property to set if maxwait has been exceeded.

The maxwaitunit and checkeveryunit are allowed to have the following values: millisecond, second, minute, hour, day and week. The default is millisecond.

Since:
  Ant 1.5

Nested Class Summary
`static class` `WaitFor.Unit` The enumeration of units: millisecond, second, minute, hour, day, week

Field Summary

Fields inherited from class org.apache.tools.ant.ProjectComponent
`project`

Constructor Summary
`WaitFor()`

Method Summary
`void` `execute()` Check repeatedly for the specified conditions until they become true or the timeout expires.
`void` `setCheckEvery(long time)` Set the time between each check
`void` `setCheckEveryUnit(WaitFor.Unit unit)` Set the check every time unit
`void` `setMaxWait(long time)` Set the maximum length of time to wait
`void` `setMaxWaitUnit(WaitFor.Unit unit)` Set the max wait time unit
`void` `setTimeoutProperty(java.lang.String p)` Name the property to set after a timeout.

Methods inherited from class org.apache.tools.ant.taskdefs.condition.ConditionBase
`add, addAnd, addAvailable, addChecksum, addContains, addEquals, addFilesMatch, addHttp, addIsFalse, addIsReference, addIsSet, addIsTrue, addNot, addOr, addOs, addSocket, addUptodate, countConditions, getConditions`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`getProject, log, log, setProject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WaitFor

    public WaitFor()

Method Detail

### setMaxWait

    public void setMaxWait(long time)

  Set the maximum length of time to wait

### setMaxWaitUnit

    public void setMaxWaitUnit(WaitFor.Unit unit)

  Set the max wait time unit

### setCheckEvery

    public void setCheckEvery(long time)

  Set the time between each check

### setCheckEveryUnit

    public void setCheckEveryUnit(WaitFor.Unit unit)

  Set the check every time unit

### setTimeoutProperty

    public void setTimeoutProperty(java.lang.String p)

  Name the property to set after a timeout.

### execute

    public void execute()
                 throws BuildException

  Check repeatedly for the specified conditions until they become true or the timeout expires.

    `BuildException`

Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.