- Timestamp:
- 10/08/12 10:23:45 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/src/schedframe/scheduling/queue/TaskQueue.java
r478 r481 1 1 package schedframe.scheduling.queue; 2 2 3 import gridsim. Gridlet;3 import gridsim.gssim.DCWormsTags; 4 4 import gssim.schedframe.scheduling.queues.AbstractStatsSupportingQueue; 5 5 6 6 import org.joda.time.DateTime; 7 7 8 import schedframe.scheduling.tasks. WorkloadUnit;8 import schedframe.scheduling.tasks.TaskInterface; 9 9 10 public class TaskQueue extends AbstractStatsSupportingQueue<WorkloadUnit> implements Queue<WorkloadUnit>{ 11 10 public class TaskQueue extends AbstractStatsSupportingQueue<TaskInterface<?>> implements Queue<TaskInterface<?>>{ 12 11 13 12 private static final long serialVersionUID = 6576299222910508209L; … … 17 16 protected boolean supportReservation; 18 17 19 20 18 public TaskQueue (boolean supportReservation){ 21 name = "Queue";22 priority = 0;19 this.name = "Queue"; 20 this.priority = 0; 23 21 this.supportReservation = supportReservation; 24 25 22 } 26 23 27 public boolean add( WorkloadUnit wu){24 public boolean add(TaskInterface<?> task){ 28 25 try { 29 wu.setStatus(Gridlet.QUEUED);26 task.setStatus(DCWormsTags.QUEUED); 30 27 } catch(Exception e){ 31 28 throw new RuntimeException(e); 32 29 } 33 //updateStats(); 34 return super.add(wu); 30 return super.add(task); 35 31 } 36 32 37 public void add(int pos, WorkloadUnit wu){33 public void add(int pos, TaskInterface<?> task){ 38 34 try { 39 wu.setStatus(Gridlet.QUEUED);35 task.setStatus(DCWormsTags.QUEUED); 40 36 } catch(Exception e){ 41 37 throw new RuntimeException(e); 42 38 } 43 //updateStats(); 44 super.add(pos, wu); 39 super.add(pos, task); 45 40 } 46 41 47 42 public DateTime getArrivalTime(int pos) throws IndexOutOfBoundsException { 48 //return get(pos).getSubmissionTimeToBroker(); 49 return null; 43 return get(pos).getSubmissionTimeToBroker(); 50 44 } 51 45 … … 69 63 return supportReservation; 70 64 } 71 72 73 /*public boolean contains (WorkloadUnitInterface<?> wu) {74 for(int i = 0; i< size();i++){75 try {76 if(get(i).getId().equals(wu.getId()))77 return true;78 } catch (NoSuchFieldException e) {79 return false;80 }81 }82 return false;83 }84 85 public boolean remove (WorkloadUnitInterface<?> wu) {86 boolean found = false;87 int index = 0;88 for(int i = 0; i< size() && !found;i++){89 try {90 if(get(i).getId().equals(wu.getId()))91 {92 found = true;93 index = i;94 }95 96 } catch (NoSuchFieldException e) {97 return false;98 }99 }100 remove(index);101 return true;102 }*/103 65 }
Note: See TracChangeset
for help on using the changeset viewer.