Package 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
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable
 - Direct Known Subclasses:
- BlockFor
 
 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 theparalleltask 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.
 processSuccessandprocessTimeout- Since:
- Ant 1.5
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classWaitFor.UnitThe enumeration of units: millisecond, second, minute, hour, day, week
 - 
Field SummaryFields Modifier and Type Field Description static longDEFAULT_CHECK_MILLISdefault check timestatic longDEFAULT_MAX_WAIT_MILLISdefault wait timestatic longONE_DAYa day in millisecondsstatic longONE_HOURan hour in millisecondsstatic longONE_MILLISECONDa millisecondstatic longONE_MINUTEa minute in millisecondsstatic longONE_SECONDa second in millisecondsstatic longONE_WEEKa week in milliseconds- 
Fields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
 
- 
 - 
Method SummaryModifier and Type Method Description longcalculateCheckEveryMillis()Get the check wait time, in milliseconds.longcalculateMaxWaitMillis()Get the maximum wait time, in milliseconds.voidexecute()Check repeatedly for the specified conditions until they become true or the timeout expires.protected voidprocessSuccess()Actions to be taken on a successful waitfor.protected voidprocessTimeout()Actions to be taken on an unsuccessful wait.voidsetCheckEvery(long time)Set the time between each checkvoidsetCheckEveryUnit(WaitFor.Unit unit)Set the check every time unitvoidsetMaxWait(long time)Set the maximum length of time to wait.voidsetMaxWaitUnit(WaitFor.Unit unit)Set the max wait time unitvoidsetTimeoutProperty(java.lang.String p)Name the property to set after a timeout.- 
Methods inherited from class org.apache.tools.ant.taskdefs.condition.ConditionBaseadd, addAnd, addAvailable, addChecksum, addContains, addEquals, addFilesMatch, addHttp, addIsFalse, addIsFileSelected, addIsReference, addIsSet, addIsTrue, addNot, addOr, addOs, addSocket, addUptodate, countConditions, getConditions, getTaskName, setTaskName
 - 
Methods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
 
- 
 
- 
- 
- 
Field Detail- 
ONE_MILLISECONDpublic static final long ONE_MILLISECOND a millisecond- See Also:
- Constant Field Values
 
 - 
ONE_SECONDpublic static final long ONE_SECOND a second in milliseconds- See Also:
- Constant Field Values
 
 - 
ONE_MINUTEpublic static final long ONE_MINUTE a minute in milliseconds- See Also:
- Constant Field Values
 
 - 
ONE_HOURpublic static final long ONE_HOUR an hour in milliseconds- See Also:
- Constant Field Values
 
 - 
ONE_DAYpublic static final long ONE_DAY a day in milliseconds- See Also:
- Constant Field Values
 
 - 
ONE_WEEKpublic static final long ONE_WEEK a week in milliseconds- See Also:
- Constant Field Values
 
 - 
DEFAULT_MAX_WAIT_MILLISpublic static final long DEFAULT_MAX_WAIT_MILLIS default wait time- See Also:
- Constant Field Values
 
 - 
DEFAULT_CHECK_MILLISpublic static final long DEFAULT_CHECK_MILLIS default check time- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
setMaxWaitpublic void setMaxWait(long time) Set the maximum length of time to wait.- Parameters:
- time- a- longvalue
 
 - 
setMaxWaitUnitpublic void setMaxWaitUnit(WaitFor.Unit unit) Set the max wait time unit- Parameters:
- unit- an enumerated- Unitvalue
 
 - 
setCheckEverypublic void setCheckEvery(long time) Set the time between each check- Parameters:
- time- a- longvalue
 
 - 
setCheckEveryUnitpublic void setCheckEveryUnit(WaitFor.Unit unit) Set the check every time unit- Parameters:
- unit- an enumerated- Unitvalue
 
 - 
setTimeoutPropertypublic void setTimeoutProperty(java.lang.String p) Name the property to set after a timeout.- Parameters:
- p- the property name
 
 - 
executepublic void execute() throws BuildExceptionCheck repeatedly for the specified conditions until they become true or the timeout expires.- Throws:
- BuildException- on error
 
 - 
calculateCheckEveryMillispublic long calculateCheckEveryMillis() Get the check wait time, in milliseconds.- Returns:
- how long to wait between checks
- Since:
- Ant 1.8
 
 - 
calculateMaxWaitMillispublic long calculateMaxWaitMillis() Get the maximum wait time, in milliseconds.- Returns:
- how long to wait before timing out
- Since:
- Ant 1.8
 
 - 
processSuccessprotected void processSuccess() Actions to be taken on a successful waitfor. This is an override point. The base implementation does nothing.- Since:
- Ant1.7
 
 - 
processTimeoutprotected void processTimeout() Actions to be taken on an unsuccessful wait. This is an override point. It is where the timeout processing takes place. The base implementation sets the timeoutproperty if there was a timeout and the property was defined.- Since:
- Ant1.7
 
 
- 
 
-