GridSim 5.0 beta

gridsim.parallel.reservation
Class ServerReservation

Object
  extended by ServerReservation
All Implemented Interfaces:
ScheduleItem

public class ServerReservation
extends Object
implements ScheduleItem

This class represents a reservation on the resource side (Server Side). This class keeps track of the time for all activities in the Grid resource for a specific reservation. Among other things, it contains a Reservation object along with its arrival time and the ranges of PEs (Processing Element) allocated to it.

Since:
5.0
Author:
Marcos Dias de Assuncao

Field Summary
 
Fields inherited from interface ScheduleItem
TIME_UNIT_HOUR, TIME_UNIT_MINUTE, TIME_UNIT_SECOND
 
Constructor Summary
ServerReservation(Reservation reservation)
          Creates a new ServerReservation object.
 
Method Summary
 double getActualFinishTime()
          Gets this object's finish time in seconds
 int getDurationTime()
          Gets this object's duration time in seconds
 double getExpectedFinishTime()
          Gets the reservation's expected finish time.
 double getExpiryTime()
          Gets this object's expiry time
 int getID()
          Gets this object's reservation ID
 int getNumPE()
          Gets this object's number of PEs.
 int getNumRemainingPE()
          Returns the number of PEs still available that have not been allocated to jobs
 int getPartitionID()
          Gets the id of the partition or queue to which this reservation was scheduled
 PERangeList getPERangeList()
          Gets the list of ranges of PEs used by this reservation
 int getPriority()
          Gets the priority of this reservation assigned by the scheduler
 double getRemainingTime()
          Gets the remaining time until the end of the reservation in seconds
 Reservation getReservation()
          Returns the reservation sent by the requester, which led to the creation of this object.
 ReservationStatus getReservationStatus()
          Gets the status of this reservation
 int getSenderID()
          Gets this object's owner ID
 double getStartTime()
          Gets this object's start time in seconds
 int getStatus()
          Gets the status of this reservation
 double getSubmissionTime()
          Returns the time of submission of this reservation
 boolean hasReserved()
          If the item is a job, this checks whether the item is associated with an advance reservation or not
 boolean isAdvanceReservation()
          Used to check if this schedule item is an advance reservation
 PERangeList selectPERangeList(int reqPE)
          Selects a range of PEs to be used by a job that arrived to use this advance reservation
 boolean setDurationTime(int duration)
          Sets the duration time (unit in seconds) for this reservation.
 void setExpiryTime(double expiryTime)
          Sets a reservation expiry time.
 boolean setPartitionID(int partition)
          Sets the id of the partition or queue to which this reservation was scheduled
 boolean setPERangeList(PERangeList rangeList)
          Sets the ranges of PEs used by this reservation
 boolean setPriority(int priority)
          Sets the priority of this reservation assigned by the scheduler
 boolean setStartTime(double startTime)
          Sets the start time (in seconds) for this reservation.
 void setStatus(ReservationStatus status)
          Sets the status of this reservation.
 boolean setSubmissionTime(double time)
          Sets the time of submission of this reservation
 String toString()
          Creates a String representation of this reservation for debugging purposes
 String toString(int timeUnit)
          Creates a String representation of this reservation for displaying purposes
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerReservation

public ServerReservation(Reservation reservation)
Creates a new ServerReservation object.

Parameters:
reservation - the reservation that this object represents. That is, the reservation sent by a requester
Method Detail

getReservation

public Reservation getReservation()
Returns the reservation sent by the requester, which led to the creation of this object.

Returns:
the reservation sent by the requester

isAdvanceReservation

public boolean isAdvanceReservation()
Used to check if this schedule item is an advance reservation

Specified by:
isAdvanceReservation in interface ScheduleItem
Returns:
true as it is an advance reservation

setPERangeList

public boolean setPERangeList(PERangeList rangeList)
Sets the ranges of PEs used by this reservation

Parameters:
rangeList - the range of PEs
Returns:
true if the range has been set or false otherwise.
Pre Condition:
rangeList != null

getPERangeList

public PERangeList getPERangeList()
Gets the list of ranges of PEs used by this reservation

Specified by:
getPERangeList in interface ScheduleItem
Returns:
a list containing the ranges

getNumRemainingPE

public int getNumRemainingPE()
Returns the number of PEs still available that have not been allocated to jobs

Returns:
the number of PEs available

selectPERangeList

public PERangeList selectPERangeList(int reqPE)
Selects a range of PEs to be used by a job that arrived to use this advance reservation

Parameters:
reqPE - the number of PEs required.
Returns:
the range to be allocated or null if no range suitable is found.

getPartitionID

public int getPartitionID()
Gets the id of the partition or queue to which this reservation was scheduled

Specified by:
getPartitionID in interface ScheduleItem
Returns:
the partition id or -1 if not found

setPartitionID

public boolean setPartitionID(int partition)
Sets the id of the partition or queue to which this reservation was scheduled

Parameters:
partition - the partition id
Returns:
true if set correctly; false otherwise.

getPriority

public int getPriority()
Gets the priority of this reservation assigned by the scheduler

Specified by:
getPriority in interface ScheduleItem
Returns:
the priority or -1 if not found

setPriority

public boolean setPriority(int priority)
Sets the priority of this reservation assigned by the scheduler

Parameters:
priority - the priority
Returns:
true if set correctly; false otherwise.

setSubmissionTime

public boolean setSubmissionTime(double time)
Sets the time of submission of this reservation

Parameters:
time - the submission time
Returns:
true if the time has been set or false otherwise.

getSubmissionTime

public double getSubmissionTime()
Returns the time of submission of this reservation

Specified by:
getSubmissionTime in interface ScheduleItem
Returns:
the submission time

setStartTime

public boolean setStartTime(double startTime)
Sets the start time (in seconds) for this reservation.

Parameters:
startTime - the reservation start time in seconds
Returns:
true if successful; false otherwise

setDurationTime

public boolean setDurationTime(int duration)
Sets the duration time (unit in seconds) for this reservation.

Parameters:
duration - the reservation duration time. Time unit is in seconds.
Returns:
true if successful; false otherwise
Pre Condition:
duration > 0

setExpiryTime

public void setExpiryTime(double expiryTime)
Sets a reservation expiry time. This method is mainly used by Reservation object.

Parameters:
expiryTime - the reservation expiry time
Pre Condition:
expiryTime > 0

setStatus

public void setStatus(ReservationStatus status)
Sets the status of this reservation.

Parameters:
status - this reservation's status

getSenderID

public int getSenderID()
Gets this object's owner ID

Specified by:
getSenderID in interface ScheduleItem
Returns:
a user ID that owns this reservation object

getStartTime

public double getStartTime()
Gets this object's start time in seconds

Specified by:
getStartTime in interface ScheduleItem
Returns:
the reservation start time in seconds

getActualFinishTime

public double getActualFinishTime()
Gets this object's finish time in seconds

Specified by:
getActualFinishTime in interface ScheduleItem
Returns:
the reservation finish time in seconds

getExpectedFinishTime

public double getExpectedFinishTime()
Gets the reservation's expected finish time. That is, this end time is based on the estimate provided by the user.
NOTE: for advance reservations, the actual and expected finish times are the same.

Specified by:
getExpectedFinishTime in interface ScheduleItem
Returns:
finish time of the advance reservation.

getDurationTime

public int getDurationTime()
Gets this object's duration time in seconds

Returns:
the reservation duration time in seconds

getRemainingTime

public double getRemainingTime()
Gets the remaining time until the end of the reservation in seconds

Returns:
the reservation remaining time in seconds

getNumPE

public int getNumPE()
Gets this object's number of PEs.

Specified by:
getNumPE in interface ScheduleItem
Returns:
the reservation number of PEs requested

getStatus

public int getStatus()
Gets the status of this reservation

Specified by:
getStatus in interface ScheduleItem
Returns:
this reservation current status

getReservationStatus

public ReservationStatus getReservationStatus()
Gets the status of this reservation

Returns:
this reservation current status

getID

public int getID()
Gets this object's reservation ID

Specified by:
getID in interface ScheduleItem
Returns:
a reservation ID

getExpiryTime

public double getExpiryTime()
Gets this object's expiry time

Returns:
expiry time

toString

public String toString(int timeUnit)
Creates a String representation of this reservation for displaying purposes

Specified by:
toString in interface ScheduleItem
Parameters:
timeUnit - the time unit to be used
Returns:
the string representation
See Also:
ScheduleItem.TIME_UNIT_SECOND, ScheduleItem.TIME_UNIT_MINUTE, ScheduleItem.TIME_UNIT_HOUR

toString

public String toString()
Creates a String representation of this reservation for debugging purposes

Overrides:
toString in class Object
Returns:
the string representation

hasReserved

public boolean hasReserved()
If the item is a job, this checks whether the item is associated with an advance reservation or not

Specified by:
hasReserved in interface ScheduleItem
Returns:
true

GridSim 5.0 beta

The University of Melbourne, Australia, 2009