Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs

public Class Sleep

extends Task
Class Inheritance
Imports
org.apache.tools.ant.BuildException, .Project, .Task

Sleep, or pause, for a period of time.

A task for sleeping a short period of time, useful when a build or deployment process requires an interval between tasks.

A negative value can be supplied to any of attributes provided the total sleep time is positive, pending fundamental changes in physics and JVM execution times

Note that sleep times are always hints to be interpreted by the OS how it feels small times may either be ignored or rounded up to a minimum timeslice. Note also that the system clocks often have a fairly low granularity too, which complicates measuring how long a sleep actually took.

Since
Ant 1.4

Field Summary

Modifier and TypeField and Description
private boolean
failOnError

failure flag

private int
hours

sleep hours

private int
milliseconds

sleep milliseconds

private int
minutes

sleep minutes

private int
seconds

sleep seconds

Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public
Sleep()

Creates new instance

Method Summary

Modifier and TypeMethod and Description
public void
doSleep(long
time to sleep
millis
)

sleep for a period of time

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Executes this build task.
private long

Returns:

sleep time. if below 0 then there is an error
getSleepTime
()

return time to sleep

public void
setFailOnError(boolean
The new FailOnError value
failOnError
)

flag controlling whether to break the build on an error.

public void
setHours(int
The new Hours value
hours
)

hours to add to the sleep time.

public void
setMilliseconds(int
The new Milliseconds value
milliseconds
)

milliseconds to add to the sleep time

public void
setMinutes(int
The new Minutes value
minutes
)

minutes to add to the sleep time

public void
setSeconds(int
The new Seconds value
seconds
)

seconds to add to the sleep time

public void
validate()

verify parameters

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

failOnErrorback to summary
private boolean failOnError

failure flag

hoursback to summary
private int hours

sleep hours

millisecondsback to summary
private int milliseconds

sleep milliseconds

minutesback to summary
private int minutes

sleep minutes

secondsback to summary
private int seconds

sleep seconds

Constructor Detail

Sleepback to summary
public Sleep()

Creates new instance

Method Detail

doSleepback to summary
public void doSleep(long millis)

sleep for a period of time

Parameters
millis:long

time to sleep

executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Executes this build task.

Annotations
@Override
Exceptions
BuildException:
if there is an error during task execution
getSleepTimeback to summary
private long getSleepTime()

return time to sleep

Returns:long

sleep time. if below 0 then there is an error

setFailOnErrorback to summary
public void setFailOnError(boolean failOnError)

flag controlling whether to break the build on an error.

Parameters
failOnError:boolean

The new FailOnError value

setHoursback to summary
public void setHours(int hours)

hours to add to the sleep time.

Parameters
hours:int

The new Hours value

setMillisecondsback to summary
public void setMilliseconds(int milliseconds)

milliseconds to add to the sleep time

Parameters
milliseconds:int

The new Milliseconds value

setMinutesback to summary
public void setMinutes(int minutes)

minutes to add to the sleep time

Parameters
minutes:int

The new Minutes value

setSecondsback to summary
public void setSeconds(int seconds)

seconds to add to the sleep time

Parameters
seconds:int

The new Seconds value

validateback to summary
public void validate() throws BuildException

verify parameters

Exceptions
BuildException:
if something is invalid