[104] | 1 | package test.rewolucja.scheduling.queue; |
---|
| 2 | |
---|
| 3 | import java.util.ArrayList; |
---|
| 4 | |
---|
| 5 | import gridsim.Gridlet; |
---|
| 6 | import gridsim.gssim.SubmittedTask; |
---|
| 7 | |
---|
| 8 | import org.joda.time.DateTime; |
---|
| 9 | |
---|
| 10 | import schedframe.scheduling.Queue; |
---|
| 11 | import test.rewolucja.GSSIMJobInterface; |
---|
| 12 | |
---|
| 13 | public class GSSIMQueue extends ArrayList<GSSIMJobInterface> implements QueueInterface<GSSIMJobInterface>{ |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | private static final long serialVersionUID = 6576299222910508209L; |
---|
| 17 | |
---|
| 18 | protected String name; |
---|
| 19 | protected int priority; |
---|
| 20 | protected boolean supportReservation; |
---|
| 21 | |
---|
| 22 | public GSSIMQueue (boolean supportReservation){ |
---|
| 23 | name = "GSSIMQueue"; |
---|
| 24 | priority = 0; |
---|
| 25 | this.supportReservation = supportReservation; |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | public boolean add(GSSIMJobInterface<?> job){ |
---|
| 29 | try { |
---|
| 30 | job.setStatus(Gridlet.QUEUED); |
---|
| 31 | } catch(Exception e){ |
---|
| 32 | throw new RuntimeException(e); |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | return super.add(job); |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | public void add(int pos, GSSIMJobInterface<?> job){ |
---|
| 39 | try { |
---|
| 40 | job.setStatus(Gridlet.QUEUED); |
---|
| 41 | } catch(Exception e){ |
---|
| 42 | throw new RuntimeException(e); |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | super.add(pos, job); |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | public DateTime getArrivalTime(int pos) throws IndexOutOfBoundsException { |
---|
| 49 | //return get(pos).getSubmissionTimeToBroker(); |
---|
| 50 | return null; |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | public String getName() { |
---|
| 54 | return name; |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | public int getPriority() { |
---|
| 58 | return priority; |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | public void setName(String name) { |
---|
| 62 | this.name = name; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | public void setPriority(int priority) { |
---|
| 66 | this.priority = priority; |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | public boolean supportReservations() { |
---|
| 70 | return supportReservation; |
---|
| 71 | } |
---|
| 72 | } |
---|