orca.shirako.core
Class ServiceManagerPolicy

java.lang.Object
  extended by orca.shirako.core.Policy
      extended by orca.shirako.core.ServiceManagerPolicy
All Implemented Interfaces:
IClientPolicy, IInitialize, IPolicy, IRecover, ISerialize, IServiceManagerPolicy
Direct Known Subclasses:
BaseServiceManagerCalendarPolicy

public class ServiceManagerPolicy
extends Policy
implements IServiceManagerPolicy


Field Summary
protected  ServiceManagerPolicyRecoverer recoverer
          The recoverer.
 
Fields inherited from class orca.shirako.core.Policy
actor, clock, guid, logger, PropertyGuid
 
Constructor Summary
ServiceManagerPolicy()
          Default constructor.
ServiceManagerPolicy(ServiceManager actor)
          Creates a new instance.
 
Method Summary
 void demand(ReservationClient reservation)
          Injects a new resource demand into the demand stream.
 Bids formulateBids(long cycle)
          Formulates bids to the upstream broker(s).
 ReservationSet getHoldings()
          Return the holdings for the actor.
 ReservationSet getHoldings(long cycle)
          Returns the holdings for the actor at the given time instance.
 ReservationSet getRedeeming(long cycle)
          Returns a set of reservations that must be redeemed.
 void initialize()
          Initializes the object.
 void leaseSatisfies(ResourceSet requestedResources, ResourceSet actualResources, Term requestedTerm, Term actualTerm)
          Checks if the resources and term received in a lease are in compliance with what was initially requested.
 void reset()
          Post recovery entry point.
 void revisit(IActor actor, java.util.Properties p)
          Recovers state of the component using a previously saved properties list and a references to the actor this component belongs to.
 void revisit(ResourceReservation reservation)
          Informs the mapper about a reservation.
 void ticketSatisfies(ResourceSet requestedResources, ResourceSet actualResources, Term requestedTerm, Term actualTerm)
          Checks if the resources and term received in a ticket are in compliance with what was initially requested.
 void updateTicketComplete(IReservation reservation)
          Notifies the policy that a ticket update operation has completed.
 
Methods inherited from class orca.shirako.core.Policy
close, closed, error, extend, finish, getClosing, getGuid, internalError, logError, logWarn, prepare, query, remove, 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
close, closed, extend, finish, getClosing, getGuid, prepare, query, remove, setActor, setLogger
 
Methods inherited from interface orca.shirako.api.ISerialize
reset, save, save
 

Field Detail

recoverer

protected ServiceManagerPolicyRecoverer recoverer
The recoverer.

Constructor Detail

ServiceManagerPolicy

public ServiceManagerPolicy()
Default constructor.


ServiceManagerPolicy

public ServiceManagerPolicy(ServiceManager actor)
Creates a new instance.

Parameters:
actor - actor the mapper belongs to
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Description copied from interface: IInitialize
Initializes the object.

Specified by:
initialize in interface IInitialize
Overrides:
initialize in class Policy
Throws:
java.lang.Exception

demand

public void demand(ReservationClient reservation)
Description copied from interface: IClientPolicy
Injects a new resource demand into the demand stream. The reservation must be pre-initialized with resource set, term, properties, etc. The policy should use this request as an indication that new resources are required. The exact mapping of the request to actual requests for resources is policy-specific. For example, the policy may choose to combine several reservation requests into one, split a reservation request onto multiple brokers, etc. This method is invoked with the kernel lock on.

Specified by:
demand in interface IClientPolicy
Parameters:
reservation - reservation representing resource demand
See Also:
IClientPolicy.formulateBids(long)

updateTicketComplete

public void updateTicketComplete(IReservation reservation)
                          throws java.lang.Exception
Description copied from interface: IClientPolicy
Notifies the policy that a ticket update operation has completed. The mapper may use this upcall to update its internal state. This method is invoked with the kernel lock on.

Specified by:
updateTicketComplete in interface IClientPolicy
Parameters:
reservation - reservation for which an update ticket operation has completed
Throws:
java.lang.Exception

formulateBids

public Bids formulateBids(long cycle)
Description copied from interface: IClientPolicy
Formulates bids to the upstream broker(s). The method should determine whether to issue bids on the current cycle. This method should consider the current demand, call broker(s) to obtain necessary information and decide how to distribute its resource demand. When deciding how to bid, also consider any expiring reservation and decide whether to renew and adjust their units. The code should only formulate the bids: the actor will then issue them. This method is invoked with the kernel lock on.

Here are some guidelines for implementing this method:


Specified by:
formulateBids in interface IClientPolicy
Parameters:
cycle - The current time
Returns:
Two collections:
  • ticketing - set of new reservations
  • extending - set of reservations to be extended Can be null if no action should be taken

getRedeeming

public ReservationSet getRedeeming(long cycle)
Description copied from interface: IServiceManagerPolicy
Returns a set of reservations that must be redeemed. This method is invoked with the kernel lock on.

Specified by:
getRedeeming in interface IServiceManagerPolicy
Parameters:
cycle - the current cycle

getHoldings

public ReservationSet getHoldings(long cycle)
Description copied from interface: IClientPolicy
Returns the holdings for the actor at the given time instance.

Specified by:
getHoldings in interface IClientPolicy
Returns:

getHoldings

public ReservationSet getHoldings()
Description copied from interface: IClientPolicy
Return the holdings for the actor.

Specified by:
getHoldings in interface IClientPolicy
Returns:
the holdings for this actor

ticketSatisfies

public void ticketSatisfies(ResourceSet requestedResources,
                            ResourceSet actualResources,
                            Term requestedTerm,
                            Term actualTerm)
                     throws java.lang.Exception
Description copied from interface: IClientPolicy
Checks if the resources and term received in a ticket are in compliance with what was initially requested. The policy can prevent the application of the incoming update if it disagrees with it. This method is invoked with the kernel lock on.

Specified by:
ticketSatisfies in interface IClientPolicy
Parameters:
requestedResources - resources requested from broker
actualResources - resources received from broker
requestedTerm - term requested from broker
actualTerm - term received from broker
Throws:
java.lang.Exception

leaseSatisfies

public void leaseSatisfies(ResourceSet requestedResources,
                           ResourceSet actualResources,
                           Term requestedTerm,
                           Term actualTerm)
                    throws java.lang.Exception
Description copied from interface: IServiceManagerPolicy
Checks if the resources and term received in a lease are in compliance with what was initially requested. The policy can prevent the application of the incoming update if it disagrees with it. This method is invoked with the kernel lock on.

Specified by:
leaseSatisfies in interface IServiceManagerPolicy
Parameters:
requestedResources - resources requested from site authority
actualResources - resources received from site authority
requestedTerm - term requested from site authority
actualTerm - term received from site authority
Throws:
java.lang.Exception

revisit

public void revisit(IActor actor,
                    java.util.Properties p)
             throws java.lang.Exception
Description copied from interface: IRecover
Recovers state of the component using a previously saved properties list and a references to the actor this component belongs to. The component can use the actor object to access other objects necessary for its complete recovery.

Specified by:
revisit in interface IRecover
Overrides:
revisit in class Policy
Parameters:
actor - actor object the component belongs to
p - properties list containing configuration data about the component
Throws:
java.lang.Exception

revisit

public void revisit(ResourceReservation reservation)
             throws java.lang.Exception
Description copied from interface: IPolicy
Informs the mapper about a reservation. Called during recovery/startup. The mapper must re-establish any state required for the management of the reservation.

Specified by:
revisit in interface IPolicy
Overrides:
revisit in class Policy
Throws:
java.lang.Exception

reset

public void reset()
           throws java.lang.Exception
Description copied from interface: IPolicy
Post recovery entry point. This method will be invoked once all revisit operations are complete and the actor is ready to operate normally.

Specified by:
reset in interface IPolicy
Overrides:
reset in class Policy
Throws:
java.lang.Exception


Copyright © 2007 Network/Internet Computing Lab. All Rights Reserved.