source: DCWoRMS/trunk/src/schedframe/scheduling/queue/TaskQueue.java @ 493

Revision 493, 1.4 KB checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package schedframe.scheduling.queue;
2
3import gridsim.dcworms.DCWormsTags;
4
5import org.joda.time.DateTime;
6
7import dcworms.schedframe.scheduling.queues.AbstractStatsSupportingQueue;
8
9import schedframe.scheduling.tasks.TaskInterface;
10
11public class TaskQueue extends AbstractStatsSupportingQueue<TaskInterface<?>> implements Queue<TaskInterface<?>>{
12
13        private static final long serialVersionUID = 6576299222910508209L;
14
15        protected String name;
16        protected int priority;
17        protected boolean supportReservation;
18       
19        public TaskQueue (boolean supportReservation){
20                this.name = "Queue";
21                this.priority = 0;
22                this.supportReservation = supportReservation;
23        }
24       
25        public boolean add(TaskInterface<?> task){
26                try {
27                        task.setStatus(DCWormsTags.QUEUED);
28                } catch(Exception e){
29                        throw new RuntimeException(e);
30                }
31                return super.add(task);
32        }
33       
34        public void add(int pos, TaskInterface<?> task){
35                try {
36                        task.setStatus(DCWormsTags.QUEUED);
37                } catch(Exception e){
38                        throw new RuntimeException(e);
39                }
40                 super.add(pos, task);
41        }
42       
43        public DateTime getArrivalTime(int pos) throws IndexOutOfBoundsException {
44                return get(pos).getSubmissionTimeToBroker();
45        }
46
47        public String getName() {
48                return name;
49        }
50
51        public int getPriority() {
52                return priority;
53        }
54
55        public void setName(String name) {
56                this.name = name;
57        }
58
59        public void setPriority(int priority) {
60                this.priority = priority;
61        }
62
63        public boolean supportReservations() {
64                return supportReservation;
65        }
66}
Note: See TracBrowser for help on using the repository browser.