|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorca.shirako.core.Policy
orca.shirako.core.ServiceManagerPolicy
orca.policy.core.BaseServiceManagerCalendarPolicy
public abstract class BaseServiceManagerCalendarPolicy
SMBasePolicyPlugin specifies and implements some of the
service manager's base resource allocation and upstream bidding policy.
| Field Summary | |
|---|---|
protected ServiceManagerCalendar |
calendar
The calendar of this service manager |
protected ActorClock |
clock
The clock |
protected java.util.HashSet<IReservationEventHandler> |
events
An event handler for upcalls |
protected boolean |
lazyClose
If true, the service manager will close reservations lazily: it will not issue a close and will wait until the site terminates the lease. |
protected LoggingTool |
logger
The logger |
protected ReservationSet |
pendingNotify
Contains reservations for which we may have completed performing bookkeeping actions but may need to wait for some other event to take place before we raise the corresponding event. |
static java.lang.String |
PropertyEventHandler
|
| Fields inherited from class orca.shirako.core.ServiceManagerPolicy |
|---|
recoverer |
| Fields inherited from class orca.shirako.core.Policy |
|---|
actor, guid, PropertyGuid |
| Constructor Summary | |
|---|---|
BaseServiceManagerCalendarPolicy()
Creates a "blank" instance. |
|
| Method Summary | |
|---|---|
void |
addEventHandler(IReservationEventHandler e)
Adds an event handler. |
protected void |
checkPending()
Checks pending bids, and installs successfully completed requests in the holdings calendar. |
void |
close(ResourceReservation reservation)
Notifies the policy that a reservation is about to be closed. |
void |
closed(ResourceReservation reservation)
Notifies the policy that a reservation has been closed. |
void |
demand(ReservationClient reservation)
Injects a new resource demand into the demand stream. |
protected void |
error(java.lang.String string)
Log and throw and exception |
void |
extend(ResourceReservation reservation,
ResourceSet resources,
Term term)
Notifies the policy that a reservation is about to be extended. |
void |
finish(long cycle)
Informs the mapper that all processing for the specified cycle is complete. |
protected abstract long |
getClose(ReservationClient reservation,
Term term)
Get the time that a reservation closes |
ReservationSet |
getClosing(long cycle)
Returns a set of reservations that must be closed. |
ReservationSet |
getHoldings()
Return the holdings for the actor. |
ReservationSet |
getHoldings(long cycle)
Returns the holdings for the actor at the given time instance. |
ReservationSet |
getPending()
Returns all reservations with pending operations. |
protected abstract long |
getRedeem(ReservationClient reservation)
Get the time when this reservation should be redeemed |
ReservationSet |
getRedeeming(long cycle)
Returns a set of reservations that must be redeemed. |
protected abstract long |
getRenew(ReservationClient reservation)
Get the time when this reservation should be renewed |
java.util.Iterator |
getTicketingReservations()
Get the reservations that are currently requesting tickets |
int |
getTicketingUnits(java.lang.String slicename)
Returns the number of units for which there is an outstanding ticket or extendTicket request |
int |
getTicketingUnits(java.lang.String slicename,
ResourceType type)
Returns the number of units for which there is an outstanding ticket or extendTicket request |
int |
getTicketingUnits(java.lang.String slicename,
java.lang.String brokerName,
ResourceType type)
Ticketing units for slice/broker/type |
void |
initialize()
Initializes the object. |
protected boolean |
isExpired(ResourceReservation r)
Checks if the reservation has expired. |
void |
remove(ResourceReservation reservation)
Notifies the policy that a reservation is about to be removed. |
void |
removeEventHandler(IReservationEventHandler e)
Removes an event handler. |
void |
revisit(ResourceReservation reservation)
Informs the mapper about a reservation. |
void |
setEventHandler(IReservationEventHandler e)
Adds an event handler. |
| Methods inherited from class orca.shirako.core.ServiceManagerPolicy |
|---|
formulateBids, leaseSatisfies, reset, revisit, ticketSatisfies, updateTicketComplete |
| Methods inherited from class orca.shirako.core.Policy |
|---|
getGuid, internalError, logError, logWarn, prepare, query, reset, save, save, setActor, setLogger |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface orca.shirako.api.IPolicy |
|---|
getGuid, prepare, query, setActor, setLogger |
| Methods inherited from interface orca.shirako.api.ISerialize |
|---|
reset, save, save |
| Field Detail |
|---|
public static java.lang.String PropertyEventHandler
protected LoggingTool logger
protected java.util.HashSet<IReservationEventHandler> events
protected ServiceManagerCalendar calendar
protected ActorClock clock
protected boolean lazyClose
protected ReservationSet pendingNotify
| Constructor Detail |
|---|
public BaseServiceManagerCalendarPolicy()
| Method Detail |
|---|
public void initialize()
throws java.lang.Exception
IInitialize
initialize in interface IInitializeinitialize in class ServiceManagerPolicyjava.lang.Exceptionpublic void finish(long cycle)
IPolicy
Note: The cycle number parameter is redundant and is passed for
convenience. The policy can always obtain the cycle number by calling
IActor.getCurrentCycle().
finish in interface IPolicyfinish in class Policycycle - the cycle number that has just passedpublic void demand(ReservationClient reservation)
IClientPolicy
demand in interface IClientPolicydemand in class ServiceManagerPolicyreservation - reservation representing resource demandIClientPolicy.formulateBids(long)public ReservationSet getClosing(long cycle)
IPolicy
getClosing in interface IPolicygetClosing in class Policycycle - the current cyclepublic ReservationSet getRedeeming(long cycle)
IServiceManagerPolicy
getRedeeming in interface IServiceManagerPolicygetRedeeming in class ServiceManagerPolicycycle - the current cyclepublic java.util.Iterator getTicketingReservations()
public int getTicketingUnits(java.lang.String slicename)
slicename - the name of the slice
public int getTicketingUnits(java.lang.String slicename,
ResourceType type)
slicename - the name of the slicetype - resource type
public int getTicketingUnits(java.lang.String slicename,
java.lang.String brokerName,
ResourceType type)
slicename - brokerName - type -
public ReservationSet getHoldings()
IClientPolicy
getHoldings in interface IClientPolicygetHoldings in class ServiceManagerPolicypublic ReservationSet getHoldings(long cycle)
IClientPolicy
getHoldings in interface IClientPolicygetHoldings in class ServiceManagerPolicypublic ReservationSet getPending()
protected void checkPending()
throws java.lang.Exception
java.lang.Exception
protected abstract long getClose(ReservationClient reservation,
Term term)
throws java.lang.Exception
reservation - the reservationterm - the term
java.lang.Exception
protected abstract long getRedeem(ReservationClient reservation)
throws java.lang.Exception
reservation - the reservation
java.lang.Exception
protected abstract long getRenew(ReservationClient reservation)
throws java.lang.Exception
reservation - the reservation
java.lang.Exception
protected void error(java.lang.String string)
throws java.lang.Exception
error in class Policystring - the exception
java.lang.Exceptionprotected boolean isExpired(ResourceReservation r)
r - reservation to check
public void revisit(ResourceReservation reservation)
throws java.lang.Exception
IPolicy
revisit in interface IPolicyrevisit in class ServiceManagerPolicyjava.lang.Exceptionpublic void close(ResourceReservation reservation)
close in interface IPolicyclose in class Policyreservation - reservation about to closepublic void closed(ResourceReservation reservation)
Note: For an authority resources are released using the
#IAuthorityPolicy.release(ResourceSet) method. Authority policy
implementations should not consider the resources of the passed
reservation as released. The release will take place once all
configuration actions complete.
closed in interface IPolicyclosed in class Policyreservation - closed reservationIAuthorityPolicy.release(ResourceSet)public void remove(ResourceReservation reservation)
Note: Only failed and closed reservations can be removed. The system will not invoke this method if the reservation is not closed or failed.
remove in interface IPolicyremove in class Policyreservation - reservation to be removed
public void extend(ResourceReservation reservation,
ResourceSet resources,
Term term)
extend in interface IPolicyextend in class Policyreservation - reservation to be extendedresources - resource set used for the extensionterm - term used for the extensionpublic void setEventHandler(IReservationEventHandler e)
e - event handlerpublic void addEventHandler(IReservationEventHandler e)
e - event handlerpublic void removeEventHandler(IReservationEventHandler e)
e - event handler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||