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    *
10   * @author Ross Mason
11   * @see com.atlassian.core.task.Task
12   */
13  public interface TaskQueue {
14      /**
15       * Will execute every task in the queue
16       */
17      void flush();
18  
19      /**
20       * Obtains the current size of the queue
21       *
22       * @return the queue size
23       */
24      int size();
25  
26      /**
27       * Adds a task to the end of the queue
28       *
29       * @param task the task to add
30       */
31      void addTask(Task task);
32  
33      /**
34       * Returns true if the queue is currently flushing or false otherwise
35       *
36       * @return true if the queue is currently flushing or false otherwise
37       */
38      boolean isFlushing();
39  
40      /**
41       * Obtains the time when the queue started flushing. This returns null
42       * if the queue is not being flushed
43       *
44       * @return the time when the queue started flushing
45       */
46      Timestamp getFlushStarted();
47  
48      /**
49       * Throw away all the tasks in the queue
50       */
51      void clear();
52  
53      /**
54       * Get a Collection of the Tasks currently in the queue
55       */
56      Collection<Task> getTasks();
57  }