|
GridSim 5.0 beta | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object Thread Sim_entity GridSimCore GridSim AdvanceReservation
public class AdvanceReservation
This class handles all Advanced Reservation (AR) functionalities, such as create, modify, cancel and query. There are two types of reservation:
GridSim.gridletSubmit(Gridlet, int)
method.
The AR methods in this class automatically handle the communication to/from a destinated grid resource entity. To use AR functionalities, you need to create a subclass of this object, i.e. creating a new class that inherits this object. This approach is preferable because the subclass is responsible for collecting Gridlets back from a resource entity.
Important properties regarding to this entity are time and
time zone. Time in this entity, GridResource entities and simulation clock
are all
relative to a given init time. In other words, future time should be greater
than init time given during
GridSim.init(int, Calendar, boolean)
method.
Imagine the following scenarios:
Time can be represented as Calendar object or long in milli seconds.
User and GridResource entities might have different time zone. Therefore, when communicating between these two entities, upon arrival, the time will be converted by an individual entity into its local time.
GridSim.init(int, Calendar, boolean, String[], String[], String)
,
GridSim.init(int, Calendar, boolean)
Nested Class Summary |
---|
Nested classes/interfaces inherited from class Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static int |
HOUR
1 Hour representation in milliseconds, i.e. |
Fields inherited from class GridSim |
---|
GRIDSIM_VERSION_STRING, PAUSE |
Fields inherited from class GridSimCore |
---|
input, NETWORK_TYPE, output |
Fields inherited from class Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
AdvanceReservation(String name,
double baudRate)
Allocates a new AdvanceReservation object. |
|
AdvanceReservation(String name,
double baudRate,
double timeZone)
Allocates a new AdvanceReservation object with a given time zone |
|
AdvanceReservation(String name,
Link link)
Allocates a new AdvanceReservation object. |
|
AdvanceReservation(String name,
Link link,
double timeZone)
Allocates a new AdvanceReservation object with a given time zone |
Method Summary | |
---|---|
int |
cancelReservation(String bookingID)
Cancels a given reservation. |
int |
cancelReservation(String bookingID,
ArrayList list)
Cancels a list of Gridlets for a given reservation. |
int |
cancelReservation(String bookingID,
Gridlet gl)
Cancels a Gridlet for a given reservation. |
int |
cancelReservation(String bookingID,
int gridletID)
Cancels a Gridlet for a given reservation. |
int |
commitReservation(String bookingID)
Commits a reservation only without sending any Gridlet objects. |
int |
commitReservation(String bookingID,
Gridlet obj)
Commits a reservation together with a Gridlet object. |
int |
commitReservation(String bookingID,
GridletList list)
Commits a reservation together with a list of Gridlet objects. |
static long |
convertTimeZone(long time,
double fromZone,
double toZone)
Converts local time from one time zone to another |
String |
createReservation(Calendar startTime,
Calendar endTime,
int numPE,
int resID)
Creates a new reservation and sends the request to a resource. |
String |
createReservation(Calendar startTime,
Calendar endTime,
int numPE,
String resName)
Creates a new reservation and sends the request to a resource. |
String |
createReservation(Calendar startTime,
int duration,
int numPE,
int resID)
Creates a new reservation and sends the request to a resource. |
String |
createReservation(Calendar startTime,
int duration,
int numPE,
String resName)
Creates a new reservation and sends the request to a resource. |
String |
createReservation(long startTime,
int duration,
int numPE,
int resID)
Creates a new reservation and sends the request to a resource. |
String |
createReservation(long startTime,
int duration,
int numPE,
String resName)
Creates a new reservation and sends the request to a resource. |
String |
createReservation(long startTime,
long endTime,
int numPE,
int resID)
Creates a new reservation and sends the request to a resource. |
String |
createReservation(long startTime,
long endTime,
int numPE,
String resName)
Creates a new reservation and sends the request to a resource. |
static String |
getCancelResult(int result)
Converts a reservation result from integer into a String. |
static String |
getCommitResult(int result)
Converts a reservation result from integer into a String. |
static String |
getCreateResult(int result)
Converts a reservation result from integer into a String. |
long |
getExpiryTime(String bookingID)
Gets an expiry time of a reservation |
static String |
getModifyResult(int result)
Converts a reservation result from integer into a String. |
static String |
getQueryResult(int result)
Converts a reservation result from integer into a String. |
ARObject |
getReservation(String bookingID)
Gets a reservation object based on the given booking ID |
int |
modifyReservation(String bookingID,
ARObject obj)
Modifies an existing reservation. |
ArrayList |
queryBusyTime(Integer resourceID,
long from,
long to)
Querys to a resource regarding to list of busy time during a period of time. |
ArrayList |
queryBusyTime(int resourceID,
long from,
long to)
Querys to a resource regarding to list of busy time during a period of time. |
ArrayList |
queryFreeTime(Integer resourceID,
long from,
long to)
Querys to a resource regarding to list of free time during a period of time. |
ArrayList |
queryFreeTime(int resourceID,
long from,
long to)
Querys to a resource regarding to list of free time during a period of time. |
int |
queryReservation(String bookingID)
Queries the overall status of a reservation. |
static boolean |
validateTimeZone(double timeZone)
Checks whether a given time zone is valid or not |
Methods inherited from class GridSimCore |
---|
finalizeGridSimulation, getLink, getPingResult, isNetworked, ping, ping, ping, ping, pingBlockingCall, pingBlockingCall, pingBlockingCall, pingBlockingCall, send, send, send, send, send, send, setBackgroundTraffic, setBackgroundTraffic, terminateIOEntities |
Methods inherited from class Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int HOUR
Constructor Detail |
---|
public AdvanceReservation(String name, double baudRate) throws Exception
name
- this entity namebaudRate
- the bandwidth of this entity
Exception
- This happens when one of the following scenarios occur:
GridSim.init(int, Calendar, boolean, String[], String[],
String)
,
GridSim.init(int, Calendar, boolean)
public AdvanceReservation(String name, double baudRate, double timeZone) throws Exception
name
- this entity namebaudRate
- the bandwidth of this entitytimeZone
- the time zone of this entity
Exception
- This happens when one of the following scenarios occur:
public AdvanceReservation(String name, Link link) throws Exception
name
- this entity namelink
- the link that this GridSim entity will use to communicate
with other GridSim or Network entities.
Exception
- This happens when one of the following scenarios occur:
GridSim.init(int, Calendar, boolean, String[], String[],
String)
,
GridSim.init(int, Calendar, boolean)
public AdvanceReservation(String name, Link link, double timeZone) throws Exception
name
- this entity namelink
- the link that this GridSim entity will use to communicate
with other GridSim or Network entities.timeZone
- the time zone of this entity
Exception
- This happens when one of the following scenarios occur:
Method Detail |
---|
public static long convertTimeZone(long time, double fromZone, double toZone)
time
- local current time in millisecondsfromZone
- local time zone of range [GMT-12 ... GMT+13]toZone
- destination time zone of range [GMT-12 ... GMT+13]
public static boolean validateTimeZone(double timeZone)
timeZone
- a time zone
public static String getCreateResult(int result)
result
- a result for a new reservation request
GridSimTags
public static String getCancelResult(int result)
result
- a result for cancel a reservation
GridSimTags
public static String getQueryResult(int result)
result
- a result for query a reservation
GridSimTags
public static String getCommitResult(int result)
result
- a result for commit a reservation
GridSimTags
public static String getModifyResult(int result)
result
- a result for modify a reservation
GridSimTags
public long getExpiryTime(String bookingID)
bookingID
- a reservation booking ID
public String createReservation(Calendar startTime, Calendar endTime, int numPE, int resID)
Immediate reservation can be used by this method by specifying one or both properties:
startTime
- reservation start timeendTime
- reservation end timenumPE
- number of PEs required for this reservationresID
- a resource ID
GridSimTags
public String createReservation(Calendar startTime, Calendar endTime, int numPE, String resName)
Immediate reservation can be used by this method by specifying one or both properties:
startTime
- reservation start timeendTime
- reservation end timenumPE
- number of PEs required for this reservationresName
- a resource name
GridSimTags
public String createReservation(Calendar startTime, int duration, int numPE, int resID)
Immediate reservation can be used by this method by specifying one or both properties:
startTime
- reservation start timeduration
- reservation duration time in secondsnumPE
- number of PEs required for this reservationresID
- a resource ID
GridSimTags
public String createReservation(Calendar startTime, int duration, int numPE, String resName)
Immediate reservation can be used by this method by specifying one or both properties:
startTime
- reservation start timeduration
- reservation duration time in secondsnumPE
- number of PEs required for this reservationresName
- a resource name
GridSimTags
public String createReservation(long startTime, long endTime, int numPE, int resID)
Immediate reservation can be used by this method by specifying one or both properties:
startTime
- reservation start time in millisecondsendTime
- reservation end time in millisecondsnumPE
- number of PEs required for this reservationresID
- a resource ID
GridSimTags
public String createReservation(long startTime, long endTime, int numPE, String resName)
Immediate reservation can be used by this method by specifying one or both properties:
startTime
- reservation start time in millisecondsendTime
- reservation end time in millisecondsnumPE
- number of PEs required for this reservationresName
- a resource name
GridSimTags
public String createReservation(long startTime, int duration, int numPE, int resID)
Immediate reservation can be used by this method by specifying one or both properties:
startTime
- reservation start time in millisecondsduration
- reservation end time in secondsnumPE
- number of PEs required for this reservationresID
- a resource ID
GridSimTags
public String createReservation(long startTime, int duration, int numPE, String resName)
Immediate reservation can be used by this method by specifying one or both properties:
startTime
- reservation start time in millisecondsduration
- reservation end time in secondsnumPE
- number of PEs required for this reservationresName
- a resource name
GridSimTags
public int modifyReservation(String bookingID, ARObject obj)
bookingID
- reservation booking IDobj
- reservation object that contains new modifications
GridSimTags
public int cancelReservation(String bookingID)
bookingID
- this reservation booking ID
GridSimTags
,
GridSim.gridletReceive()
,
GridSim.gridletReceive(int, int, int)
public int cancelReservation(String bookingID, ArrayList list)
bookingID
- this reservation booking IDlist
- a list of Gridlet IDs (each ID is an Integer object).
Each Gridlet ID should be unique and no duplicate.
GridSimTags
,
GridSim.gridletReceive()
,
GridSim.gridletReceive(int, int, int)
,
GridSim.gridletCancel(int, int, int, double)
,
GridSim.gridletCancel(Gridlet, int, double)
public int cancelReservation(String bookingID, Gridlet gl)
bookingID
- this reservation booking IDgl
- a Gridlet object
GridSimTags
,
GridSim.gridletReceive()
,
GridSim.gridletReceive(int, int, int)
,
GridSim.gridletCancel(int, int, int, double)
,
GridSim.gridletCancel(Gridlet, int, double)
public int cancelReservation(String bookingID, int gridletID)
bookingID
- this reservation booking IDgridletID
- a Gridlet ID
GridSimTags
,
GridSim.gridletReceive()
,
GridSim.gridletReceive(int, int, int)
,
GridSim.gridletCancel(int, int, int, double)
,
GridSim.gridletCancel(Gridlet, int, double)
public ArrayList queryFreeTime(Integer resourceID, long from, long to)
resourceID
- a resource IDfrom
- starting time in millisecondsto
- ending time in milliseconds
public ArrayList queryFreeTime(int resourceID, long from, long to)
resourceID
- a resource IDfrom
- starting time in millisecondsto
- ending time in milliseconds
public ArrayList queryBusyTime(int resourceID, long from, long to)
resourceID
- a resource IDfrom
- starting time in millisecondsto
- ending time in milliseconds
public ArrayList queryBusyTime(Integer resourceID, long from, long to)
resourceID
- a resource IDfrom
- starting time in millisecondsto
- ending time in milliseconds
public ARObject getReservation(String bookingID)
bookingID
- a reservation booking ID
public int queryReservation(String bookingID)
To find out the status for a specific Gridlet, use
GridSim.gridletStatus(int, int, int)
method instead.
bookingID
- this reservation booking ID
GridSimTags
,
GridSim.gridletStatus(int, int, int)
,
GridSim.gridletStatus(Gridlet, int)
public int commitReservation(String bookingID)
commitReservation(String, GridletList)
or
commitReservation(String, Gridlet)
.
A return value for this method uses one of
of GridSimTags.AR_COMMIT_XXXX tags, where XXXX = specific tag name.
bookingID
- a reservation booking ID
GridSimTags
,
commitReservation(String, Gridlet)
,
commitReservation(String, GridletList)
public int commitReservation(String bookingID, GridletList list)
bookingID
- a reservation booking IDlist
- a list of Gridlet objects. Each Gridlet's user ID, by
default is set to this entity ID.
Gridlet.setUserID(int)
,
GridSimTags
public int commitReservation(String bookingID, Gridlet obj)
bookingID
- a reservation booking IDobj
- a Gridlet object. A Gridlet's user ID, by default is
set to this entity ID.
Gridlet.setUserID(int)
,
GridSimTags
|
GridSim 5.0 beta | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |