orca.shirako.core
Class ServiceManager

java.lang.Object
  extended by orca.shirako.core.Actor
      extended by orca.shirako.core.ServiceManager
All Implemented Interfaces:
IActor, IActorIdentity, IActorPublic, IClientActor, IClientPublic, IInitialize, IRecover, IReservationOperations, ISerialize, IServiceManager, IServiceManagerPublic, ISliceOperations, ITick

public class ServiceManager
extends Actor
implements IServiceManager

ServiceManager is the base implementation for a service manager actor.


Field Summary
protected  boolean initialized
          initialization status
protected  ILoadSource loadSource
          Source of load.
static java.lang.String PropertyLoadSource
           
protected  PeerRegistry registry
          Peer registry.
 
Fields inherited from class orca.shirako.core.Actor
clock, currentCycle, DefaultDescription, description, firstTick, fromDB, guid, identity, kernel, logger, monitor, policy, PropertyAuthToken, PropertyDescription, PropertyManager, PropertyMapper, PropertyMapperClass, PropertyPlugin, PropertyPluginClass, PropertyType, recovered, spi, stopped, type, wrapper
 
Fields inherited from interface orca.shirako.api.IActor
PropertyClass, PropertyGuid, PropertyName, TypeAll, TypeBroker, TypeServiceManager, TypeSiteAuthority
 
Constructor Summary
ServiceManager()
          Default constructor.
ServiceManager(AuthToken identity, ActorClock clock)
          Creates a new service manager with the given identity and clock factory.
 
Method Summary
 void actorAdded()
          Informs the actor that it has been integrated in the container.
 void addBroker(IBrokerProxy broker)
          Registers a broker.
protected  void bid()
          Bids for resources as dictated by the plugin bidding policy for the current cycle.
 ReservationClient claim(ReservationID reservationID, ResourceSet resources)
          Claims already exported resources from the default upstream broker.
 ReservationClient claim(ReservationID reservationID, ResourceSet resources, IBrokerProxy broker)
          Claims already exported resources from the given broker.
 ReservationClient claim(ReservationID reservationID, ResourceSet resources, Slice slice, IBrokerProxy broker)
          Claims already exported resources from the given broker.
protected  void closeExpiring()
          Issue close requests on all reservations scheduled for closing on the current cycle
 void demand(ReservationClient reservation)
          Injects a new resource demand into the demand stream.
 void extendLease(ReservationClient reservation)
          Issues an extend lease request for the given reservation.
 void extendLease(ReservationSet set)
          Issues an extend lease request for every reservation in the set.
 void extendTicket(ReservationClient reservation)
          Issues a ticket extend request for the given reservation.
 void extendTicket(ReservationSet set)
          Issues a ticket request for every reservation in the set.
 IBrokerProxy getBroker(java.lang.String name)
          Gets the broker proxy with the given name
 IBrokerProxy[] getBrokers()
          Returns all brokers registered with the service manager.
 java.util.Vector<IController> getControllers()
          Returns all registered controllers.
 IBrokerProxy getDefaultBroker()
          Returns the default broker.
 ILoadSource getLoadSource()
          Returns the load source.
 void initialize()
          Initializes a generic actor.
protected  void initializeControllers()
          Initializes all controllers.
protected  void processRedeeming()
          Issue redeem requests on all reservations scheduled for redeeming on the current cycle
 void redeem(ReservationClient reservation)
          Issues a redeem request for the given reservation.
 void redeem(ReservationSet set)
          Issues a redeem request for every reservation in the set.
 void reset(java.util.Properties p)
          De-serializes the object from the given properties list.
 void save(java.util.Properties p)
          Serializes the object into the given properties list.
 void setLoadSource(ILoadSource source)
          Sets the load source.
 void ticket(ReservationClient reservation)
          Issues a ticket request for the given reservation.
 void ticket(ReservationSet set)
          Issues a ticket request for every reservation in the set.
protected  void tickHandler()
          Handles a timer interrupt.
 void updateLease(ResourceReservation r, UpdateData udd, AuthToken caller)
          Handles an incoming lease update.
 void updateTicket(ResourceReservation reservation, UpdateData udd, AuthToken caller)
          Handles an incoming ticket update.
 
Methods inherited from class orca.shirako.core.Actor
close, close, close, error, extend, extend, externalTick, getActorClock, getClientSlices, getCurrentCycle, getDescription, getGuid, getIdentity, getInventorySlices, getKernel, getLogger, getName, getName, getPolicy, getReservation, getReservations, getShirakoPlugin, getSlice, getSlices, getType, getType, initializeKeyStore, internalError, isFromDatabase, isRecovered, isStopped, query, recover, register, registerSlice, removeReservation, removeReservation, removeSlice, removeSlice, reregister, reregisterSlice, reset, revisit, save, setActorClock, setDescription, setGuid, setIdentity, setLogger, setPolicy, setRecovered, setShirakoPlugin, setStopped, start, stop, toString, unregister, unregister, unregisterSlice, unregisterSlice
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface orca.shirako.api.IActor
getActorClock, getCurrentCycle, getDescription, getLogger, getPolicy, getShirakoPlugin, getType, initializeKeyStore, isFromDatabase, isRecovered, isStopped, recover, setActorClock, setDescription, setGuid, setIdentity, setLogger, setPolicy, setRecovered, setShirakoPlugin, start, stop
 
Methods inherited from interface orca.shirako.api.ITick
externalTick
 
Methods inherited from interface orca.shirako.api.ISerialize
save
 
Methods inherited from interface orca.shirako.api.IRecover
revisit
 
Methods inherited from interface orca.shirako.api.IActorPublic
query
 
Methods inherited from interface orca.shirako.api.IActorIdentity
getGuid, getIdentity, getName
 
Methods inherited from interface orca.shirako.api.ISliceOperations
getClientSlices, getInventorySlices, getSlice, getSlices, registerSlice, removeSlice, removeSlice, reregisterSlice, unregisterSlice, unregisterSlice
 
Methods inherited from interface orca.shirako.api.IReservationOperations
close, close, close, extend, extend, getReservation, getReservations, register, removeReservation, removeReservation, reregister, unregister, unregister
 

Field Detail

PropertyLoadSource

public static final java.lang.String PropertyLoadSource
See Also:
Constant Field Values

loadSource

protected ILoadSource loadSource
Source of load. Can be null.


registry

protected PeerRegistry registry
Peer registry.


initialized

protected boolean initialized
initialization status

Constructor Detail

ServiceManager

public ServiceManager()
Default constructor. Used for dynamic instantiation from configuration files.


ServiceManager

public ServiceManager(AuthToken identity,
                      ActorClock clock)
Creates a new service manager with the given identity and clock factory.

Parameters:
identity - actor identity
clock - clock factory
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Description copied from class: Actor
Initializes a generic actor.

Specified by:
initialize in interface IInitialize
Overrides:
initialize in class Actor
Throws:
java.lang.Exception - Throws exception of some required fields are missing.

actorAdded

public void actorAdded()
                throws java.lang.Exception
Description copied from interface: IActor
Informs the actor that it has been integrated in the container. This method should finish the initialization of the actor: some initialization steps may not be able to execute until the actor is part of the running container.

Specified by:
actorAdded in interface IActor
Overrides:
actorAdded in class Actor
Throws:
java.lang.Exception

initializeControllers

protected void initializeControllers()
                              throws java.lang.Exception
Initializes all controllers.

Throws:
java.lang.Exception

getControllers

public java.util.Vector<IController> getControllers()
Description copied from interface: IServiceManager
Returns all registered controllers.

Specified by:
getControllers in interface IServiceManager
Returns:
an array of registered controllers

save

public void save(java.util.Properties p)
          throws java.lang.Exception
Description copied from interface: ISerialize
Serializes the object into the given properties list.

Specified by:
save in interface ISerialize
Overrides:
save in class Actor
Parameters:
p - properties list to serialize the object into
Throws:
java.lang.Exception

reset

public void reset(java.util.Properties p)
           throws java.lang.Exception
Description copied from interface: ISerialize
De-serializes the object from the given properties list.

Specified by:
reset in interface ISerialize
Overrides:
reset in class Actor
Parameters:
p - properties list containing the serialized version of the object
Throws:
java.lang.Exception

updateTicket

public void updateTicket(ResourceReservation reservation,
                         UpdateData udd,
                         AuthToken caller)
                  throws java.lang.Exception
Description copied from interface: IClientPublic
Handles an incoming ticket update.

Specified by:
updateTicket in interface IClientPublic
Parameters:
reservation - reservation represented by this update. The reservation object will contain the ticket (if any) as well information about the actually allocated resources.
udd - status of the remote operation.
caller - identity of the caller
Throws:
java.lang.Exception

updateLease

public void updateLease(ResourceReservation r,
                        UpdateData udd,
                        AuthToken caller)
                 throws java.lang.Exception
Description copied from interface: IServiceManagerPublic
Handles an incoming lease update.

Specified by:
updateLease in interface IServiceManagerPublic
Parameters:
r - reservation represented by this update. The reservation object will contain the lease (if any) as well information about the actually leased resources.
udd - status of the remote operation.
caller - identity of the caller
Throws:
java.lang.Exception

demand

public void demand(ReservationClient reservation)
Description copied from interface: IClientActor
Injects a new resource demand into the demand stream. Reservation must be pre-initialized with resource set, term, properties, etc. The actor policy periodically examines the demand stream and determines what resources must be obtained and how. For example, the policy may choose to combine several reservation requests into one, split a reservation request onto multiple brokers, etc.

Specified by:
demand in interface IClientActor
Parameters:
reservation - reservation representing resource demand

redeem

public void redeem(ReservationSet set)
Description copied from interface: IServiceManager
Issues a redeem request for every reservation in the set. All exceptions are caught and logged but no exception is propagated. No information will be delivered to indicate that some failure has taken place, e.g., failure to communicate with a broker. Inspect the state of individual reservations to determine whether/what failures have taken place.

Specified by:
redeem in interface IServiceManager
Parameters:
set - set of reservations to redeem

redeem

public void redeem(ReservationClient reservation)
            throws java.lang.Exception
Description copied from interface: IServiceManager
Issues a redeem request for the given reservation. Note: the reservation must have already been registered with the actor.

Specified by:
redeem in interface IServiceManager
Parameters:
reservation - reservation to be redeemed
Throws:
java.lang.Exception
See Also:
IReservationOperations#register(orca.shirako.kernel.Reservation)

extendLease

public void extendLease(ReservationClient reservation)
                 throws java.lang.Exception
Description copied from interface: IServiceManager
Issues an extend lease request for the given reservation. Note: the reservation must have already been registered with the actor.

Specified by:
extendLease in interface IServiceManager
Parameters:
reservation - reservation to be redeemed
Throws:
java.lang.Exception
See Also:
IReservationOperations#register(orca.shirako.kernel.Reservation)

extendLease

public void extendLease(ReservationSet set)
                 throws java.lang.Exception
Description copied from interface: IServiceManager
Issues an extend lease request for every reservation in the set. All exceptions are caught and logged but no exception is propagated. No information will be delivered to indicate that some failure has taken place, e.g., failure to communicate with a broker. Inspect the state of individual reservations to determine whether/what failures have taken place.

Specified by:
extendLease in interface IServiceManager
Parameters:
set - set of reservations to extend the lease for
Throws:
java.lang.Exception

ticket

public void ticket(ReservationClient reservation)
            throws java.lang.Exception
Description copied from interface: IClientActor
Issues a ticket request for the given reservation. Note: the reservation must have already been registered with the actor.

Specified by:
ticket in interface IClientActor
Parameters:
reservation - reservation to obtain a ticket for
Throws:
java.lang.Exception
See Also:
IReservationOperations#register(orca.shirako.kernel.Reservation)

ticket

public void ticket(ReservationSet set)
Description copied from interface: IClientActor
Issues a ticket request for every reservation in the set. All exceptions are caught and logged but no exception is propagated. No information will be delivered to indicate that some failure has taken place, e.g., failure to communicate with a broker. Inspect the state of individual reservations to determine whether/what failures have taken place.

Specified by:
ticket in interface IClientActor
Parameters:
set - set of reservations to obtain tickets for

extendTicket

public void extendTicket(ReservationClient reservation)
                  throws java.lang.Exception
Description copied from interface: IClientActor
Issues a ticket extend request for the given reservation. Note: the reservation must have already been registered with the actor.

Specified by:
extendTicket in interface IClientActor
Parameters:
reservation - reservation to extend the ticket for
Throws:
java.lang.Exception
See Also:
IReservationOperations#register(orca.shirako.kernel.Reservation)

extendTicket

public void extendTicket(ReservationSet set)
Description copied from interface: IClientActor
Issues a ticket request for every reservation in the set. All exceptions are caught and logged but no exception is propagated. No information will be delivered to indicate that some failure has taken place, e.g., failure to communicate with a broker. Inspect the state of individual reservations to determine whether/what failures have taken place.

Specified by:
extendTicket in interface IClientActor
Parameters:
set - set of reservations to extend tickets for

claim

public ReservationClient claim(ReservationID reservationID,
                               ResourceSet resources)
                        throws java.lang.Exception
Description copied from interface: IClientActor
Claims already exported resources from the default upstream broker. The reservation will be stored in the default slice.

Specified by:
claim in interface IClientActor
Parameters:
reservationID - reservation identifier of the exported reservation
resources - resource set describing the resources to claim
Throws:
java.lang.Exception

claim

public ReservationClient claim(ReservationID reservationID,
                               ResourceSet resources,
                               IBrokerProxy broker)
                        throws java.lang.Exception
Description copied from interface: IClientActor
Claims already exported resources from the given broker. The reservation will be stored in the default slice.

Specified by:
claim in interface IClientActor
Parameters:
reservationID - reservation identifier of the exported reservation
resources - resource set describing the resources to claim
broker - broker proxy
Throws:
java.lang.Exception

claim

public ReservationClient claim(ReservationID reservationID,
                               ResourceSet resources,
                               Slice slice,
                               IBrokerProxy broker)
                        throws java.lang.Exception
Description copied from interface: IClientActor
Claims already exported resources from the given broker.

Specified by:
claim in interface IClientActor
Parameters:
reservationID - reservation identifier of the exported reservation
resources - resource set describing the resources to claim
slice - slice in which to store the claimed reservation. As of now, it is assumed that the exported reservation is stored under a slice with the same name in the upstream broker.
Throws:
java.lang.Exception

addBroker

public void addBroker(IBrokerProxy broker)
Description copied from interface: IClientActor
Registers a broker. If this is the first broker to be registered, it is set as the default broker.

Specified by:
addBroker in interface IClientActor
Parameters:
broker - broker to register

getBroker

public IBrokerProxy getBroker(java.lang.String name)
Description copied from interface: IClientActor
Gets the broker proxy with the given name

Specified by:
getBroker in interface IClientActor
Parameters:
name - broker name
Returns:
requested broker

getDefaultBroker

public IBrokerProxy getDefaultBroker()
Description copied from interface: IClientActor
Returns the default broker.

Specified by:
getDefaultBroker in interface IClientActor
Returns:
the default broker

getBrokers

public IBrokerProxy[] getBrokers()
Returns all brokers registered with the service manager.

Specified by:
getBrokers in interface IClientActor
Returns:
an array of brokers

tickHandler

protected void tickHandler()
                    throws java.lang.Exception
Handles a timer interrupt. This is the main actor loop. Add here any code that should be invoked for each passed cycle. The current cycle is in Actor.currentCycle and is guaranteed not to change until the handle invocation completes.

Overrides:
tickHandler in class Actor
Throws:
java.lang.Exception

closeExpiring

protected void closeExpiring()
Issue close requests on all reservations scheduled for closing on the current cycle


processRedeeming

protected void processRedeeming()
Issue redeem requests on all reservations scheduled for redeeming on the current cycle


bid

protected void bid()
            throws java.lang.Exception
Bids for resources as dictated by the plugin bidding policy for the current cycle.

Throws:
java.lang.Exception

setLoadSource

public void setLoadSource(ILoadSource source)
Description copied from interface: IServiceManager
Sets the load source.

Specified by:
setLoadSource in interface IServiceManager
Parameters:
source - load source to set

getLoadSource

public ILoadSource getLoadSource()
Description copied from interface: IServiceManager
Returns the load source.

Specified by:
getLoadSource in interface IServiceManager
Returns:
the load source


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