Class TaskNode

java.lang.Object
com.valhalla.sdk.tasks.TaskNode
All Implemented Interfaces:
Sleepable

public abstract class TaskNode extends Object implements Sleepable
One prioritized state in a TaskScript.

On each script loop, nodes are considered from highest to lowest priority. Only the first node whose accept(ScriptContext) returns true executes during that loop.

  • Constructor Details

    • TaskNode

      public TaskNode()
  • Method Details

    • priority

      public int priority()
      Defines selection order among sibling nodes.
      Returns:
      priority value; larger values are considered first
    • accept

      public abstract boolean accept(ScriptContext context)
      Tests whether this node currently owns the next unit of work.

      Keep this check fast and side-effect free because it may run every loop.

      Parameters:
      context - current script context
      Returns:
      true when execute(ScriptContext) should run now
    • execute

      public abstract long execute(ScriptContext context)
      Performs one bounded unit of work.
      Parameters:
      context - current script context
      Returns:
      requested delay before the next script loop; a negative value requests stop