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

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