|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorca.shirako.kernel.Kernel
public class Kernel
The "kernel" of the slices core: one Manager object exists for each locally
instantiated actor, and it handles the synchronized internals of all
operations on the actor, after argument validation/prepare steps in
KernelWrapper.
This is a generic resource manager suitable for use in any slices server: authority, agent/broker, or service manager. The resource manager maintains a collection of slices, each of which has a set of Reservations; each Reservation has a set of assigned resources (e.g., nodes). The manager initiates asynchronous setup and teardown on reservations, monitors reservation status, and queues completions for reservation state changes. Resource state may change out from under us, so the manager frequently probes and refreshes its cached state.
The manager plugs in under the generic server/actor. In general, public methods in this module are called from SlicesActor. This manager class does not distinguish between client and server, since they maintain identical data structures at the manager level. The different contexts use different implementations for the Reservation class, concrete resource sets, (underneath generic ResourceSet), and a SlicesPlugin to manage underlying reservation and slice state (e.g., for Cluster-on-Demand or a database layer).
The current server implementations synchronize through synchronized methods on this class. All state changes hold a lock on the Manager. All data structures in the slices package are protected by this lock. Objects passed in are from the parser and must be checked against the current (locked) state. Errors propagate as exceptions suitable for returning to the client. This module is semi-atomic: client errors do not corrupt manager state. Note: "service" operations on Reservations are unlocked for concurrency.
| Constructor Summary | |
|---|---|
Kernel(IShirakoPlugin plugin,
IPolicy mapper,
LoggingTool logger)
Creates a new kernel instance. |
|
| Method Summary | |
|---|---|
protected void |
amendReserve(ResourceReservation reservation)
Amends a previous reserve operation (both client and server side) for the reservation. |
protected void |
claim(BrokerReservation reservation)
Processes a requests to claim new ticket for previously exported resources (broker role). |
protected void |
close(ResourceReservation reservation)
Handles a close operation for the reservation. |
protected int |
compareAndUpdate(ReservationClient incoming,
ReservationClient current,
boolean ticket)
Compares the sequence numbers of both reservations. |
protected int |
compareAndUpdate(ReservationServer incoming,
ReservationServer current)
Compares the incoming request to the corresponding reservation stored at this actor. |
protected int |
compareAndUpdateIgnorePending(ReservationServer incoming,
ReservationServer current)
Similar to compareAndUpdate but will update the reservation even if there is a pending operation currently in progress. |
protected void |
extendLease(ResourceReservation reservation)
Handles an extend lease operation for the reservation. |
protected int |
extendReservation(ReservationID rid,
ResourceSet rset,
Term term)
Extends the reservation with the given resources and term. |
protected int |
extendReservation(ResourceReservation reservation,
ResourceSet resources,
Term term)
Extends the reservation with the given resources and term. |
protected void |
extendTicket(ResourceReservation reservation)
Handles an extend ticket operation for the reservation. |
Slice[] |
getClientSlices()
Returns all client slices registered with the kernel. |
Slice[] |
getInventorySlices()
Returns all inventory slices registered with the kernel. |
protected Slice |
getLocalSlice(Slice slice)
Returns the slice object registered with the kernel that corresponds to the argument. |
protected Slice |
getOrCreateLocalSlice(AuthToken identity,
ResourceReservation reservation,
boolean createNewSlice)
Returns the slice specified in the reservation or creates a new slice with the given parameters. |
ResourceReservation |
getReservation(ReservationID rid)
Returns the reservation with the given reservation identifier. |
ResourceReservation[] |
getReservations(SliceID sliceID)
Returns all reservations in the given slice |
Slice |
getSlice(SliceID sliceID)
Returns the slice with the given name. |
Slice[] |
getSlices()
Returns all slice registered with the kernel. |
IShirakoPlugin |
getSlicesPlugin()
Returns the Shirako plugin. |
protected void |
handleDuplicateRequest(ResourceReservation current,
int operation)
|
protected void |
notify(int id,
IReservation r)
Raises the specified event |
protected void |
probePending(ResourceReservation reservation)
Probes to check for completion of pending operation. |
protected void |
redeem(ReservationClient reservation)
Issues a redeem for a new ticket in Service Manager role. |
void |
registerReservation(ResourceReservation reservation)
Registers the given reservation with the kernel. |
void |
registerSlice(Slice slice)
Registers the slice with the kernel: adds the slice object to the kernel data structures and adds a database record for the slice. |
void |
removeReservation(ReservationID rid)
Unregisters the reservation from the kernel data structures and removes its record from the database. |
void |
removeSlice(SliceID sliceID)
Unregisters the slice (if it is registered with the kernel) and removes it from the database. |
void |
reregisterReservation(ResourceReservation reservation)
Registers a previously unregistered reservation with the kernel. |
void |
reregisterSlice(Slice slice)
Registers the slice with the kernel: adds the slice object to the kernel data structures. |
protected void |
reserve(ResourceReservation reservation)
Handles a reserve operation for the reservation. |
protected ResourceReservation |
softValidate(ReservationID rid)
Retrieves the locally registered reservation that corresponds to the passed reservation. |
protected ResourceReservation |
softValidate(ResourceReservation r)
Retrieves the locally registered reservation that corresponds to the passed reservation. |
void |
tick()
Checks all reservations for completions or problems. |
void |
unregisterReservation(ReservationID rid)
Unregisters the reservation from the kernel data structures. |
void |
unregisterSlice(SliceID sliceID)
Unregisters the slice and releases any resources that it may hold. |
protected void |
updateLease(ResourceReservation reservation,
ResourceReservation update,
UpdateData udd)
Handles an incoming update lease operation (client side only). |
protected void |
updateTicket(ReservationClient reservation,
ResourceReservation update,
UpdateData udd)
Handles an incoming update ticket operation (client side only). |
protected ResourceReservation |
validate(ReservationID rid)
Retrieves the locally registered reservation that corresponds to the passed reservation. |
protected ResourceReservation |
validate(ResourceReservation reservation)
Retrieves the locally registered reservation that corresponds to the passed reservation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Kernel(IShirakoPlugin plugin,
IPolicy mapper,
LoggingTool logger)
plugin - Shirako plugin instancemapper - policylogger - logger| Method Detail |
|---|
public void registerSlice(Slice slice)
throws java.lang.Exception
IKernel
registerSlice in interface IKernelslice - slice to register
java.lang.Exception - if the slice is already registered or a database error
occurs. If a database error occurs, the slice will be
unregistered.
public void reregisterSlice(Slice slice)
throws java.lang.Exception
IKernel
reregisterSlice in interface IKernelslice - slice to register
java.lang.Exception - if the slice is already registered or a database error
occurs. If a database error occurs, the slice will be
unregistered.
public void unregisterSlice(SliceID sliceID)
throws java.lang.Exception
IKernelNote: A slice can be unregistered only if it contains only closed or failed reservations.
unregisterSlice in interface IKernelsliceID - identifier of slice to unregister
java.lang.Exception
public void removeSlice(SliceID sliceID)
throws java.lang.Exception
IKernelNote: A slice can be removed only if it contains only closed or failed reservations.
removeSlice in interface IKernelsliceID - identifier of slice to remove
java.lang.Exceptionpublic Slice getSlice(SliceID sliceID)
IKernel
getSlice in interface IKernelsliceID - identifier of slice to return
protected Slice getLocalSlice(Slice slice)
throws java.lang.Exception
slice - incoming slice object
java.lang.IllegalArgumentException - if the arguments are invalid
java.lang.Exception - if no locally registered slice object exists
protected Slice getOrCreateLocalSlice(AuthToken identity,
ResourceReservation reservation,
boolean createNewSlice)
throws java.lang.Exception
identity - actor identityname - slice nameresourceData - slice parametersagentClient - true if this slice represents an broker acting as a
clientother - additional parameters
java.lang.Exceptionpublic Slice[] getSlices()
IKernel
getSlices in interface IKernelpublic Slice[] getInventorySlices()
IKernel
getInventorySlices in interface IKernelpublic Slice[] getClientSlices()
IKernel
getClientSlices in interface IKernel
public void registerReservation(ResourceReservation reservation)
throws java.lang.Exception
IKernelIKernel.reregisterReservation(ResourceReservation). Only reservations
that are not closed or failed can be registered. Closed or failed
reservations will be ignored.
registerReservation in interface IKernelreservation - the reservation to register
java.lang.IllegalArgumentException - when the passed in argument is illegal
java.lang.Exception - if the reservation has already been registered with the
kernel.
java.lang.RuntimeException - when a database error occurs. In this case the
reservation will be unregistered from the kernel data
structures.
public void reregisterReservation(ResourceReservation reservation)
throws java.lang.Exception
IKernelIKernel.registerReservation(ResourceReservation). Only reservations
that are not closed or failed can be registered. Closed or failed
reservations will be ignored.
reregisterReservation in interface IKernelreservation - the reservation to reregister
java.lang.IllegalArgumentException - when the passed in argument is illegal
java.lang.Exception - if the reservation has already been registered with the
kernel or the reservation does not have a database record. In
the latter case the reservation will be unregistered from the
kernel data structures.
java.lang.RuntimeException - if a database error occurs
public void unregisterReservation(ReservationID rid)
throws java.lang.Exception
IKernelNote: does not remove the reservation database record.
*Note:Only failed, closed, or close waiting reservations can be unregistered.
unregisterReservation in interface IKernelrid - identifier for reservation to unregister
java.lang.IllegalArgumentException - when the passed in argument is illegal
java.lang.Exceptionpublic ResourceReservation getReservation(ReservationID rid)
IKernel
getReservation in interface IKernelrid - reservation identifier
public ResourceReservation[] getReservations(SliceID sliceID)
IKernel
getReservations in interface IKernelsliceID - identifier of slice
protected ResourceReservation validate(ResourceReservation reservation)
throws java.lang.Exception
reservation - reservation being validated
java.lang.Exception - if there is no local reservation that corresponds to
the passed reservation
protected ResourceReservation validate(ReservationID rid)
throws java.lang.Exception
rid - reservation identifier of reservation being validated
java.lang.Exception - if there is no local reservation that corresponds to
the passed reservation
protected ResourceReservation softValidate(ResourceReservation r)
throws java.lang.Exception
reservation - reservation being validated
java.lang.IllegalArgumentException - if the arguments are invalid
java.lang.Exception - if the slice referenced by the incoming reservation is
not locally registered
protected ResourceReservation softValidate(ReservationID rid)
throws java.lang.Exception
rid - reservation identifier or reservation being validated
java.lang.IllegalArgumentException - if the arguments are invalid
java.lang.Exception
public void removeReservation(ReservationID rid)
throws java.lang.Exception
IKernelNote:Only failed, closed, or close waiting reservations can be removed.
removeReservation in interface IKernelrid - identifier of reservation to remove
java.lang.Exception
protected int extendReservation(ResourceReservation reservation,
ResourceSet resources,
Term term)
throws java.lang.Exception
reservation - reservation to extendresources - resources to use for the extensionterm - term to use for the extension
ImageManagerConstants.ReservationHasPendingOperation if the
reservation has a pending operation, which prevents the extend
operation from being initiated.
java.lang.Exception
protected int extendReservation(ReservationID rid,
ResourceSet rset,
Term term)
throws java.lang.Exception
reservation - reservation identifier of reservation to extendresources - resources to use for the extensionterm - term to use for the extension
ImageManagerConstants.ReservationHasPendingOperation if the
reservation has a pending operation, which prevents the extend
operation from being initiated.
java.lang.Exception
protected void reserve(ResourceReservation reservation)
throws java.lang.Exception
Client: issue a ticket request or a claim request.
Broker: process a request for a new ticket. Claims for previously
exported tickets are handled by claim(BrokerReservation).
Authority: process a request for a new lease.
reservation - reservation for which to perform redeem
java.lang.Exception
protected void amendReserve(ResourceReservation reservation)
throws java.lang.Exception
reservation - the reservation
java.lang.Exceptionreserve(ResourceReservation)
protected void redeem(ReservationClient reservation)
throws java.lang.Exception
reservation - reservation being redeemed
java.lang.Exception
protected void claim(BrokerReservation reservation)
throws java.lang.Exception
reserve(ResourceReservation).
reservation - the reservation being claimed
java.lang.Exception
protected void extendTicket(ResourceReservation reservation)
throws java.lang.Exception
Client: issue an extend ticket request.
Broker: process a request for a ticket extension.
reservation - reservation for which to perform extend ticket
java.lang.Exception
protected void extendLease(ResourceReservation reservation)
throws java.lang.Exception
Client: issue an extend lease request.
Authority: process a request for a lease extension.
reservation - reservation for which to perform extend lease
java.lang.Exception
protected void close(ResourceReservation reservation)
throws java.lang.Exception
Client: perform local close operations and issue close request to authority.
Broker: perform local close operations
Authority: process a close request
reservation - reservation for which to perform close
java.lang.Exception
protected void updateTicket(ReservationClient reservation,
ResourceReservation update,
UpdateData udd)
throws java.lang.Exception
reservation - local reservationupdate - update sent from upstream brokerudd - status of the operation the broker is informing us about
java.lang.Exception
protected void updateLease(ResourceReservation reservation,
ResourceReservation update,
UpdateData udd)
throws java.lang.Exception
reservation - local reservationupdate - update sent from site authorityudd - status of the operation the authority is informing us about
java.lang.Exception
protected void probePending(ResourceReservation reservation)
throws java.lang.Exception
reservation - the reservation being probed
java.lang.Exception - rare
protected void notify(int id,
IReservation r)
throws java.lang.Exception
id - event idr - reservation this event is associated with
java.lang.Exception
public void tick()
throws java.lang.Exception
IKernel
tick in interface IKerneljava.lang.Exception
protected int compareAndUpdate(ReservationClient incoming,
ReservationClient current,
boolean ticket)
protected int compareAndUpdate(ReservationServer incoming,
ReservationServer current)
incoming - the incoming requestcurrent - the corresponding reservation stored at the server
protected int compareAndUpdateIgnorePending(ReservationServer incoming,
ReservationServer current)
incoming - the incoming requestcurrent - the corresponding reservation stored at the server
compareAndUpdate(ReservationServer, ReservationServer)
protected void handleDuplicateRequest(ResourceReservation current,
int operation)
throws java.lang.Exception
java.lang.Exceptionpublic IShirakoPlugin getSlicesPlugin()
IKernel
getSlicesPlugin in interface IKernel
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||