|
GridSim 5.0 beta | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object Thread Sim_entity AllocPolicy ARPolicy
public abstract class ARPolicy
ARPolicy is an abstract class that handles the internal
GridResource
allocation policy related to Advanced Reservation functionalities.
New scheduling algorithms can be added into a GridResource
entity by extending this class and implement the required abstract methods.
AllocPolicy
abstract methods are also need to be
implemented.
All the implementation details and the data structures chosen are up to
the child class. All the protected methods and attributes are available
to code things easier. Child classes should use
replyXXXReservation() methods
where XXX = Cancel / Commit / Query / Time / Create. This is because
these methods send a correct format or message to
AdvanceReservation
class. Sending an incorrect message will caused an exception on the
receiver's side.
GridSim
,
ResourceCharacteristics
,
AdvanceReservation
,
AllocPolicy
Nested Class Summary |
---|
Nested classes/interfaces inherited from class Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected static int |
MILLI_SEC
A constant variable that represents 1 second in 1,000 milliseconds. |
Fields inherited from class AllocPolicy |
---|
initTime_, myId_, outputPort_, resCalendar_, resId_, resName_, resource_, totalPE_ |
Fields inherited from class Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
protected |
ARPolicy(String resourceName,
String entityName)
Allocates a new ARPolicy object. |
Method Summary | |
---|---|
protected int |
approxBusyTime(long time)
Approximates busy time |
protected long |
getCurrentTime()
Gets the current time. |
abstract void |
handleCancelReservation(int reservationID,
int senderID,
ArrayList list,
int sendTag)
An abstract method that handles a cancel reservation request. |
abstract void |
handleCancelReservation(int reservationID,
int senderID,
int sendTag)
An abstract method that handles a cancel reservation request. |
abstract void |
handleCancelReservation(int reservationID,
int senderID,
int gridletID,
int sendTag)
An abstract method that handles a cancel reservation request. |
abstract void |
handleCommitOnly(int reservationID,
int senderID,
int sendTag)
An abstract method that handles a commit reservation request. |
abstract void |
handleCommitReservation(int reservationID,
int senderID,
int sendTag,
Gridlet gridlet)
An abstract method that handles a commit reservation request. |
abstract void |
handleCommitReservation(int reservationID,
int senderID,
int sendTag,
GridletList list)
An abstract method that handles a commit reservation request. |
abstract void |
handleCreateReservation(ARObject obj,
int senderID,
int sendTag)
An abstract method that handles a new advanced reservation request. |
abstract void |
handleImmediateReservation(ARObject obj,
int senderID,
int sendTag)
An abstract method that handles a new immediate reservation request. |
abstract void |
handleModifyReservation(ARObject obj,
int senderID,
int sendTag)
An abstract method that handles a modify reservation request. |
abstract void |
handleQueryBusyTime(long from,
long to,
int senderID,
int sendTag,
double userTimeZone)
An abstract method that handles a query busy time request. |
abstract void |
handleQueryFreeTime(long from,
long to,
int senderID,
int sendTag,
double userTimeZone)
An abstract method that handles a query free time request. |
abstract void |
handleQueryReservation(int reservationID,
int senderID,
int sendTag)
An abstract method that handles a query reservation request. |
protected void |
replyCancelReservation(int destID,
int tag,
int result)
Sends a result of a cancel reservation request. |
protected void |
replyCommitReservation(int destID,
int tag,
int result)
Sends a result of a commit reservation request. |
protected void |
replyCreateReservation(int destID,
int tag,
long expiryTime,
int reservID)
Sends a result of a create reservation request. |
protected void |
replyModifyReservation(int destID,
int tag,
int result)
Sends a result of a modify reservation request. |
protected void |
replyQueryReservation(int destID,
int tag,
int result)
Sends a result of a query reservation request. |
protected void |
replyTimeReservation(int destID,
int tag,
ArrayList result,
double userTimeZone)
Sends a result of a query busy or free time request. |
protected int |
searchReservation(Collection obj,
int reservationID)
Search for a particular reservation in a data structure |
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 |
---|
protected static final int MILLI_SEC
Constructor Detail |
---|
protected ARPolicy(String resourceName, String entityName) throws Exception
resourceName
- the GridResource entity name that will contain
this allocation policyentityName
- this object entity name
Exception
- This happens when one of the following scenarios occur:
GridSim.init(int, Calendar, boolean)
,
GridSim.init(int, Calendar, boolean, String[], String[],
String)
Method Detail |
---|
public abstract void handleImmediateReservation(ARObject obj, int senderID, int sendTag)
replyCreateReservation(int, int, long, int)
method should be
used to send a result back to sender or user.
An immediate reservation requests a reservation immediately, i.e.
the current time is used as the start time with/without specifying
duration or end time.
Immediate reservation can be done by one of the following ways:
obj
- a reservation objectsenderID
- a sender or user IDsendTag
- a tag to send to the userpublic abstract void handleCreateReservation(ARObject obj, int senderID, int sendTag)
replyCreateReservation(int, int, long, int)
method should be
used to send a result back to sender or user.
obj
- a reservation objectsenderID
- a sender or user IDsendTag
- a tag to send to the userpublic abstract void handleModifyReservation(ARObject obj, int senderID, int sendTag)
replyModifyReservation(int, int, int)
method should be used
to send a result back to sender or user.
obj
- a reservation objectsenderID
- a sender or user IDsendTag
- a tag to send to the userpublic abstract void handleCancelReservation(int reservationID, int senderID, int gridletID, int sendTag)
replyCancelReservation(int, int, int)
method should be used
to send a result back to sender or user.
reservationID
- a reservation IDsenderID
- a sender or user IDgridletID
- a gridlet IDsendTag
- a tag to send to the userpublic abstract void handleCancelReservation(int reservationID, int senderID, ArrayList list, int sendTag)
replyCancelReservation(int, int, int)
method should be used
to send a result back to sender or user.
reservationID
- a reservation IDsenderID
- a sender or user IDlist
- a list of Gridlet IDs (each ID is represented as
an Integer object)sendTag
- a tag to send to the userpublic abstract void handleCancelReservation(int reservationID, int senderID, int sendTag)
replyCancelReservation(int, int, int)
method should be used
to send a result back to sender or user.
reservationID
- a reservation IDsenderID
- a sender or user IDsendTag
- a tag to send to the userpublic abstract void handleCommitOnly(int reservationID, int senderID, int sendTag)
handleCommitReservation(int, int, int, Gridlet)
or
handleCommitReservation(int, int, int, GridletList)
method.replyCommitReservation(int, int, int)
method should be used
to send a result back to sender or user.
reservationID
- a reservation IDsenderID
- a sender or user IDsendTag
- a tag to send to the userpublic abstract void handleCommitReservation(int reservationID, int senderID, int sendTag, Gridlet gridlet)
replyCommitReservation(int, int, int)
method should be
used to send a result back to sender or user.
reservationID
- a reservation IDsenderID
- a sender or user IDsendTag
- a tag to send to the usergridlet
- a Gridlet objectpublic abstract void handleCommitReservation(int reservationID, int senderID, int sendTag, GridletList list)
replyCommitReservation(int, int, int)
method should be
used to send a result back to sender or user.
reservationID
- a reservation IDsenderID
- a sender or user IDsendTag
- a tag to send to the userlist
- a list of Gridlet objectspublic abstract void handleQueryReservation(int reservationID, int senderID, int sendTag)
replyQueryReservation(int, int, int)
method should be
used to send a result back to sender or user.
reservationID
- a reservation IDsenderID
- a sender or user IDsendTag
- a tag to send to the userpublic abstract void handleQueryBusyTime(long from, long to, int senderID, int sendTag, double userTimeZone)
replyTimeReservation(int, int, ArrayList, double)
method should
be used to send a result back to sender or user.
from
- starting period time (local resource time)to
- ending period time (local resource time)senderID
- a sender or user IDsendTag
- a tag to send to the userpublic abstract void handleQueryFreeTime(long from, long to, int senderID, int sendTag, double userTimeZone)
replyTimeReservation(int, int, ArrayList, double)
method should
be used to send a result back to sender or user.
from
- starting period time (local resource time)to
- ending period time (local resource time)senderID
- a sender or user IDsendTag
- a tag to send to the userprotected void replyCreateReservation(int destID, int tag, long expiryTime, int reservID)
destID
- a destination or user IDtag
- a tag to send to the userexpiryTime
- reservation expiry time. If no empty slots, then
expiryTime should be set to -1reservID
- a reservation ID. If no empty slots, then reservID
should be set to one of GridSimTags.AR_CREATE_XXXX tags where
XXXX = a specific tag name.GridSimTags
protected void replyCancelReservation(int destID, int tag, int result)
destID
- a destination or user IDtag
- a tag to send to the userresult
- a result tag. This tag should be one of
GridSimTags.AR_CANCEL_XXXX where XXXX = a specific tag name.GridSimTags
protected void replyCommitReservation(int destID, int tag, int result)
destID
- a destination or user IDtag
- a tag to send to the userresult
- a result tag. This tag should be one of
GridSimTags.AR_COMMIT_XXXX where XXXX = a specific tag name.GridSimTags
protected void replyQueryReservation(int destID, int tag, int result)
destID
- a destination or user IDtag
- a tag to send to the userresult
- a result tag. This tag should be one of
GridSimTags.AR_STATUS_XXXX where XXXX = a specific tag name.GridSimTags
protected void replyModifyReservation(int destID, int tag, int result)
destID
- a destination or user IDtag
- a tag to send to the userresult
- a result tag. This tag should be one of
GridSimTags.AR_MODIFY_XXXX where XXXX = a specific tag name.GridSimTags
protected void replyTimeReservation(int destID, int tag, ArrayList result, double userTimeZone)
destID
- a destination or user IDtag
- a tag to send to the userresult
- a list of results.
Each object inside ArrayList is long array[3], with:
GridSimTags
protected long getCurrentTime()
protected int searchReservation(Collection obj, int reservationID)
obj
- a data structurereservationID
- a reservation ID
protected int approxBusyTime(long time)
time
- busy time
|
GridSim 5.0 beta | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |