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