Class GTaskGroup


  • public class GTaskGroup
    extends java.lang.Object
    Class for grouping several GTasks that all should be executed before any new group of tasks are executed, regardless of priority.
    See Also:
    GTaskManager
    • Constructor Summary

      Constructors 
      Constructor Description
      GTaskGroup​(java.lang.String description, boolean startNewTransaction)
      Creates a new named GTaskGroup.
    • Constructor Detail

      • GTaskGroup

        public GTaskGroup​(java.lang.String description,
                          boolean startNewTransaction)
        Creates a new named GTaskGroup.
        Parameters:
        description - the display name for the group.
        startNewTransaction - if true, any existing transaction (if there is one) will be closed and a new transaction will be created. Otherwise, the tasks in this group will be executed in the same transaction as the previous group. Note that this can only happen if there was a previous group executing at the time this group is scheduled.
    • Method Detail

      • addTask

        public GScheduledTask addTask​(GTask task,
                                      int priority)
        Add a task to this group with the given priority. Tasks can only be added to this group before the group is added to the GTaskManager. After that, an IllegalStateException will be thrown.
        Parameters:
        task - the task being added to this group.
        priority - the priority for the task within the group.
        Returns:
        the GScheduledTask created to schedule this task within the group.
        Throws:
        java.lang.IllegalStateException - if this method is called after the group has been added to the GTaskManager.
      • getTasks

        public java.util.List<GScheduledTask> getTasks()
        Returns a list scheduled tasks in the group.
        Returns:
        a list scheduled tasks in the group.
      • getTaskMonitor

        public GTaskMonitor getTaskMonitor()
        Returns the TaskMonitor that will be used to track the overall progress of tasks within this group.
        Returns:
        the TaskMonitor that will be used to track the overall progress of tasks within this group.
      • wantsNewTransaction

        public boolean wantsNewTransaction()
        Returns true if this group wants to start a new transaction when it runs. Otherwise, the group will add-on to any existing transaction from the previous group.
        Returns:
        true if a new transaction should be started for this group.
      • getDescription

        public java.lang.String getDescription()
        Returns a description for the group.
        Returns:
        a description for this group.
      • compareTo

        public int compareTo​(GTaskGroup group)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setCancelled

        public void setCancelled()
        Cancels the group. Any tasks that haven't yet started will never run.
      • wasCancelled

        public boolean wasCancelled()
        Returns true if this group was cancelled.
        Returns:
        true if this group was cancelled.
      • taskCompleted

        public void taskCompleted()
        Notification that a task in the group has been completed. The group keeps track of the overall progress of the tasks completed in this group. This call is used to notify the group that another one of its tasks was completed.
      • setScheduled

        public void setScheduled()