Limit (Ant Contrib)
Keywords: net.sf.antcontrib.process.Limit,Limit class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.antcontrib.process
Class Limit

    java.lang.Object
      |
      +--org.apache.tools.ant.ProjectComponent
            |
            +--org.apache.tools.ant.Task
                  |
                  +--net.sf.antcontrib.process.Limit

All Implemented Interfaces:
  org.apache.tools.ant.TaskContainer

public class Limit
extends org.apache.tools.ant.Task
implements org.apache.tools.ant.TaskContainer

Limits the amount of time that a task or set of tasks can run. This is useful for tasks that may "hang" or otherwise not complete in a timely fashion. This task is done when either the maxwait time has expired or all nested tasks are complete, whichever is first.

Developed for use with Antelope, migrated to ant-contrib Oct 2003.

Since:
  Ant 1.5
Version:
  $Revision: 1.1 $
Author:
  Dale Anson, danson@germane-software.com

Field Summary

Fields inherited from class org.apache.tools.ant.Task
`description, location, target, taskName, taskType, wrapper`

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

Constructor Summary
`Limit()`

Method Summary
`void` | `addTask(org.apache.tools.ant.Task task)` Add a task to wait on.
`void` | `execute()` Execute all nested tasks, but stopping execution of nested tasks after maxwait seconds or when all tasks are done, whichever is first.
`void` | `setFailonerror(boolean fail)` Should the build fail if the time limit has expired on this task? Default is no.
`void` | `setMaxwait(int wait)` How long to wait for all nested tasks to complete.

Methods inherited from class org.apache.tools.ant.Task
`getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName`

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

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

Constructor Detail

### Limit

    public Limit()

Method Detail

### addTask

    public void addTask(org.apache.tools.ant.Task task)
                 throws org.apache.tools.ant.BuildException

  Add a task to wait on.

  Specified by:
    `addTask` in interface `org.apache.tools.ant.TaskContainer`
  Parameters:
    `task` - A task to execute
  Throws:
    `org.apache.tools.ant.BuildException` - won't happen

### setMaxwait

    public void setMaxwait(int wait)

  How long to wait for all nested tasks to complete. Default is to wait 180 seconds (= 3 minutes).

  Parameters:
    `wait` - time to wait in seconds, set to 0 to wait forever.

### setFailonerror

    public void setFailonerror(boolean fail)

  Should the build fail if the time limit has expired on this task? Default is no.

  Parameters:
    `fail` - if true, fail the build if the time limit has been reached.

### execute

    public void execute()
                 throws org.apache.tools.ant.BuildException

  Execute all nested tasks, but stopping execution of nested tasks after maxwait seconds or when all tasks are done, whichever is first.

  Overrides:
    `execute` in class `org.apache.tools.ant.Task`
  Throws:
    `org.apache.tools.ant.BuildException` - Description of the Exception

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD