Class ThreadedAction

  • All Implemented Interfaces:
    IAction, ISchedulableAction

    public class ThreadedAction
    extends AbstractAction
    An ISchedulableAction that will run in the background for some specificable number of ticks (the duration). If the ThreadedAction is still running after that number of ticks, the ThreadedAction will behave like a normal foreground action, that is, the the schedule will wait until the ThreadedAction completes before executing the next scheduled actions.
    Author:
    Nick Collier
    • Constructor Detail

      • ThreadedAction

        public ThreadedAction​(ScheduleParameters param,
                              IAction action,
                              long orderIndex)
        Creates a ThreadedAction to execute the specified IAction according to the specified scheduling parameters.
        Parameters:
        param - the scheduling data
        action - the action to execute
        orderIndex - the index when this was added
    • Method Detail

      • setFrequency

        protected void setFrequency​(Frequency type)
        Sets the execution frequency.
        Overrides:
        setFrequency in class AbstractAction
        Parameters:
        type - the execution frequency.
      • execute

        public void execute()
        Executes this ThreadedAction. If the action has not yet started, this will create the background thread and start to run it. If the thread has started this will wait for the thread to complete.