View Javadoc

1   package com.atlassian.core.task;
2   
3   import java.sql.Timestamp;
4   import java.util.Collection;
5   
6   /**
7    * Represents a queue of Task objects.  Arbitary task objects can be queue and then flushed when necessary.
8    * The flush will cause all tasks in the queue to execute.
9    * @see com.atlassian.core.task.Task
10   *
11   * @author Ross Mason
12   */
13  public interface TaskQueue
14  {
15      /**
16       * Will execute every task in the queue
17       */
18      void flush();
19  
20      /**
21       * Obtains the current size of the queue
22       * @return the queue size
23       */
24      int size();
25  
26      /**
27       * Adds a task to the end of the queue
28       * @param task the task to add
29       */
30      void addTask(Task task);
31  
32      /**
33       * Returns true if the queue is currently flushing or false otherwise
34       * @return true if the queue is currently flushing or false otherwise
35       */
36      boolean isFlushing();
37  
38      /**
39       * Obtains the time when the queue started flushing. This returns null
40       * if the queue is not being flushed
41       * @return the time when the queue started flushing
42       */
43      Timestamp getFlushStarted();
44  
45      /**
46       * Throw away all the tasks in the queue
47       */
48      void clear();
49  
50      /**
51       * Get a Collection of the Tasks currently in the queue
52       */
53      Collection<Task> getTasks();
54  }