com.massimo.tools.scriptrunner.control
Class PollTask
java.lang.Object
   com.massimo.tools.scriptrunner.AbstractTask
com.massimo.tools.scriptrunner.AbstractTask
       com.massimo.tools.scriptrunner.control.AbstractCompoundTask
com.massimo.tools.scriptrunner.control.AbstractCompoundTask
           com.massimo.tools.scriptrunner.control.PollTask
com.massimo.tools.scriptrunner.control.PollTask
- All Implemented Interfaces: 
- Task
- public class PollTask 
- extends AbstractCompoundTask
Poll the single child task until it finishes successfully or a time limit is reached.
 
Introduces the integer-valued attributes 
 Constants.ATTRIBUTE_DURATION and
 Constants.ATTRIBUTE_POLL.
 
 
 
 
 
 
| Methods inherited from class com.massimo.tools.scriptrunner.AbstractTask | 
| getBooleanProperty, getCurrentWorkingDirectory, getDefinition, getIntProperty, getName, getParent, getProperties, getStartProcessingRow, getText, getType, isIgnoreableError, isIgnoreableError, isInterrupted, isLogProgress, postProcess, preProcess, process, resultCodeToString, substituteParameters, toString, validate, validateConnections, validateParameters | 
 
 
DEFAULT_DURATION
protected static final int DEFAULT_DURATION
- See Also:
- Constant Field Values
DEFAULT_POLL
protected static final int DEFAULT_POLL
- See Also:
- Constant Field Values
PollTask
public PollTask(Task parent,
                String type,
                Element definition,
                Map<String,String> contextProperties)
- Parameters:
- parent-
- type-
- definition-
- contextProperties-
doValidate
protected int doValidate(ValidationContext context)
                  throws Exception
- Check whether this task should be able to run.
 Implementations should check for the prescence of files, attributes,...
 
 Validates all child tasks
 Checks the attributes Constants.ATTRIBUTE_POLL
 and Constants.ATTRIBUTE_DURATION
 
- 
- Overrides:
- doValidatein class- AbstractCompoundTask
 
- 
- Returns:
- O for success. Anything else is a failure.
- Throws:
- Exception
 
getLogger
protected org.apache.log4j.Logger getLogger()
- 
 
- 
- Specified by:
- getLoggerin class- AbstractTask
 
- 
- Returns:
- Class logger
 
interrupt
public void interrupt()
- Tells the Task to stop processing.
 This does not garrantee that the task will return immediately.
 
 Attempt to interrupt all children.
 Attempt to interrupt the sleeping thread.
 
- 
- Specified by:
- interruptin interface- Task
- Overrides:
- interruptin class- AbstractCompoundTask
 
- 
 
processCompound
protected int processCompound(ExecutionContext context,
                              Elements tasks)
                       throws Exception
- Polls the child Task every Constants.ATTRIBUTE_POLL seconds
 for up to Constants.ATTRIBUTE_DURATION seconds. 
 This succeeds if the child Tasks succeeds within the given duration.
 
- 
- Specified by:
- processCompoundin class- AbstractCompoundTask
 
- 
- Parameters:
- context-
- tasks- A list of Task definition Elements
- Returns:
- The result of running all tasks
- Throws:
- Exception