|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorca.shirako.kernel.Reservation
public abstract class Reservation
Reservation is the base for all reservation objects. It
implements a part of the IReservation interface and defines
the core functions expected by the kernel from all reservation classes. This
is an abstract class and is intended as a building block of higher-level
reservation classes.
| Nested Class Summary | |
|---|---|
protected class |
Reservation.CountHelper
Helper class for counting units. |
| Field Summary | |
|---|---|
protected IActor |
actor
Cached pointer to the actor that operates on this reservation. |
protected int |
category
Reservation category. |
protected long |
closeTime
The cycle in which the reservation must be closed. |
protected boolean |
dirty
Dirty flag. |
protected java.lang.String |
errMsg
Error message. |
protected boolean |
expired
True if this reservation is expired. |
protected boolean |
extended
Has this reservation been extended? |
protected ReservationState |
from
State before the last transition. |
protected Guard |
guard
Access control monitor |
protected java.util.HashSet<IStateChangeListener> |
listeners
A set of registered state listeners for this reservation. |
protected LoggingTool |
logger
Informational logger |
protected int |
pending
Reservation pending state. |
static java.lang.String |
PropertyCategory
|
static java.lang.String |
PropertyCloseTime
|
static java.lang.String |
PropertyExtended
|
static java.lang.String |
PropertyGuard
|
static java.lang.String |
PropertyPending
|
static java.lang.String |
PropertySlice
|
static java.lang.String |
PropertySliceID
|
static java.lang.String |
PropertyState
|
protected ReservationID |
rid
The unique reservation identifier. |
protected Slice |
slice
Slice this reservation belongs to. |
protected SliceID |
sliceID
Cached slice id. |
protected java.lang.String |
slicename
Cached slice name. |
protected int |
state
Reservation state. |
protected boolean |
stateTransition
True if the last state transition is not committed to external storage. |
| Fields inherited from interface orca.shirako.api.IReservation |
|---|
CategoryAll, CategoryAuthority, CategoryBroker, CategoryClient, PropertyClass, PropertyID |
| Constructor Summary | |
|---|---|
Reservation()
|
|
| Method Summary | |
|---|---|
void |
awaitActive()
Waits for this reservation to become active. |
void |
awaitClosed()
Waits for the reservation to close. |
void |
awaitTicketed()
Waits for this reservation to be ticketed. |
protected void |
claim()
Claim an exported "will call" reservation. |
void |
clearDirty()
Marks that the reservation has no uncommitted updates and state transitions. |
protected void |
clearNotice()
Clears all event notices associated with the reservation. |
protected void |
close()
Close the reservation No exceptions: catch and log errors. |
static ResourceReservation |
createInstance(java.util.Properties p)
Creates and initializes a new reservation from a saved properties list. |
protected void |
error(java.lang.String err)
Logs an error and throws an exception |
protected void |
extendLease()
|
protected void |
extendTicket(IActor actor)
Extend ticket |
IActor |
getActor()
Returns the actor in control of the reservation. |
int |
getCategory()
Returns the reservation category. |
static int |
getCategory(java.util.Properties p)
Extracts the reservation category embedded in the properties list |
long |
getCloseTime()
Returns the time the reservation is scheduled to be closed. |
protected Guard |
getGuard()
Returns the guard associated with the reservation. |
protected java.lang.String |
getNotice()
Returns a descriptive string if this reservation requires attention, else null. |
int |
getPendingState()
Returns the current pending reservation state |
java.lang.String |
getPendingStateName()
Returns the name of the current pending reservation state |
ReservationState |
getPreviousReservationState()
Returns the previous composite reservation state. |
ReservationID |
getReservationID()
Returns the reservation identifier. |
static ReservationID |
getReservationID(java.util.Properties p)
Extracts the reservation identifier from the properties list. |
ReservationState |
getReservationState()
Returns the current composite reservation state. |
Slice |
getSlice()
Returns the slice the reservation belongs to. |
SliceID |
getSliceID()
|
java.lang.String |
getSliceName()
Returns the name of the slice the reservation belongs to. |
static java.lang.String |
getSliceName(java.util.Properties p)
Extracts the slice name from the properties list. |
int |
getState()
Returns the current reservation state. |
java.lang.String |
getStateName()
Returns the name of the current reservation state. |
protected void |
handleDuplicateRequest(int operation)
Handles a duplicate request. |
boolean |
hasUncommittedTransition()
Checks if the reservation has uncommitted state transitions. |
protected void |
internalError(java.lang.String err)
Logs the specified error and throws an exceptions. |
boolean |
isActive()
Checks if the reservation is active. |
boolean |
isActiveTicketed()
Checks if the reservation is activeTicketed. |
boolean |
isClosed()
Checks if the reservation is closed. |
boolean |
isClosing()
Checks if the reservation is closing. |
boolean |
isDirty()
Checks if the reservation has uncommitted updates. |
boolean |
isExpired()
Checks if the reservation has expired. |
boolean |
isExtended()
Checks if the reservation has extended at least once. |
boolean |
isExtendingLease()
Checks if the reservation is extending a lease. |
boolean |
isExtendingTicket()
Checks if the reservation is extending a ticket. |
boolean |
isFailed()
Checks if the reservation has failed. |
boolean |
isNascent()
Checks if the reservation is nascent |
boolean |
isNoPending()
Checks if there is no pending operation. |
boolean |
isPriming()
Checks if the reservation is priming. |
boolean |
isRedeeming()
Checks if the reservation is redeeming. |
boolean |
isTerminal()
Checks if the reservation is terminal, e.g., closing, closed, or failed. |
boolean |
isTicketed()
Check if the reservation is ticketed. |
boolean |
isTicketing()
Checks if the reservation is obtaining a new ticket. |
protected void |
logError(java.lang.String err)
Logs an error |
protected void |
logException(java.lang.String err,
java.lang.Exception e)
Logs an exception related to the reservation. |
protected void |
logRemoteError(java.lang.String err)
Logs an error that occurred on a peer |
protected void |
logTransition()
|
protected void |
logWarning(java.lang.String err)
Logs a warning about the reservation. |
protected void |
nothingPending()
Throws an exception iff this reservation has a pending operation. |
protected void |
notifyListeners()
Notifies all state change listeners about a transition from the previous to the current state. |
protected void |
notifyListeners(ReservationState from,
ReservationState to)
Notifies all state change listers about the current transition |
protected void |
prepareProbe()
Prepare a reservation probe |
protected void |
probe()
Probes a reservation and sync with resource status and client (server only). |
protected void |
probePending()
Probe a reservation with a pending request. |
protected void |
ready()
An incoming client request named this validated Reservation object for an existing reservation. |
void |
registerListener(IStateChangeListener l)
Registers a listener. |
protected void |
reserve(IPolicy policy)
Reserve resources: ticket() initiate or request, or redeem() request. |
void |
reset(java.util.Properties p)
De-serializes the object from the given properties list. |
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. |
java.util.Properties |
save()
Serializes the object into a properties list. |
void |
save(java.util.Properties p)
Serializes the object into the given properties list. |
protected java.util.Properties |
saveID()
Saves enough information to identify the reservation. |
protected void |
serviceClaim()
|
protected void |
serviceClose()
Unlocked - Close the reservation |
protected void |
serviceExtendLease()
Unlocked - Extend lease |
protected void |
serviceExtendTicket()
Unlocked - Extend ticket |
protected void |
serviceProbe()
Unlocked - Services a probe by completing any complete operations. |
protected void |
serviceReserve()
Unlocked - Reserve resources: ticket() initiate or request, or redeem() request (new reservation). |
protected void |
serviceUpdateLease()
Unlocked - Update the lease |
protected void |
serviceUpdateTicket()
Unlocked - Update the ticket |
protected void |
setActor(IActor actor)
Sets the actor in control of the reservation. |
void |
setCloseTime(long closeTime)
Returns the time the reservation is scheduled to be closed. |
void |
setDirty()
Marks the reservation as containing uncommitted updates. |
void |
setExpired(boolean value)
Sets the expiration flag. |
protected void |
setLogger(LoggingTool logger)
Attaches the logger to use for the reservation. |
void |
setSlice(Slice slice)
Sets the slice the reservation belongs to. |
protected void |
transition(java.lang.String prefix,
int state,
int pending)
Transitions this reservation into a new state. |
void |
unregisterListener(IStateChangeListener l)
Unregisters the listener. |
protected void |
updateLease(ResourceReservation rarg,
UpdateData udd)
Update the lease |
protected void |
updateTicket(ResourceReservation rarg,
UpdateData udd)
Update the ticket |
protected void |
validate()
Validates the reservation. |
protected void |
validateIncoming()
Validates a reservation as it arrives to an actor |
protected void |
validateOutgoing()
Validates a reservation as it is about to leave an actor |
| 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.IReservationStatus |
|---|
isExpired |
| Field Detail |
|---|
public static final java.lang.String PropertyCategory
public static final java.lang.String PropertyState
public static final java.lang.String PropertyPending
public static final java.lang.String PropertyGuard
public static final java.lang.String PropertyExtended
public static final java.lang.String PropertySlice
public static final java.lang.String PropertySliceID
public static final java.lang.String PropertyCloseTime
protected ReservationID rid
protected int category
protected Slice slice
protected int state
protected int pending
protected Guard guard
protected boolean extended
protected long closeTime
protected java.lang.String slicename
protected SliceID sliceID
protected ReservationState from
protected LoggingTool logger
protected java.lang.String errMsg
protected boolean dirty
protected boolean expired
protected IActor actor
protected java.util.HashSet<IStateChangeListener> listeners
protected boolean stateTransition
| Constructor Detail |
|---|
public Reservation()
| Method Detail |
|---|
public java.util.Properties save()
throws java.lang.Exception
ISerialize
save in interface ISerializejava.lang.Exception
public void save(java.util.Properties p)
throws java.lang.Exception
ISerialize
save in interface ISerializep - properties list to serialize the object into
java.lang.Exception
protected java.util.Properties saveID()
throws java.lang.Exception
java.lang.Exception
public void reset(java.util.Properties p)
throws java.lang.Exception
ISerialize
reset in interface ISerializep - properties list containing the serialized version of
the object
java.lang.Exception
public void revisit(IActor actor,
java.util.Properties p)
throws java.lang.Exception
IRecover
revisit in interface IRecoveractor - actor object the component belongs top - properties list containing configuration data about the
component
java.lang.Exceptionprotected void logTransition()
protected void transition(java.lang.String prefix,
int state,
int pending)
state - the new statepending - if reservation is pending
protected void notifyListeners(ReservationState from,
ReservationState to)
from - state transitioned fromto - state transitioned toprotected void notifyListeners()
protected void reserve(IPolicy policy)
throws java.lang.Exception
policy - the mapper for the reservation
java.lang.Exception
protected void serviceReserve()
throws java.lang.Exception
mapper - the mapper for the reservation
java.lang.Exception
protected void claim()
throws java.lang.Exception
java.lang.Exception
protected void serviceClaim()
throws java.lang.Exception
java.lang.Exception
protected void extendTicket(IActor actor)
throws java.lang.Exception
newterm - the new term for the ticket
java.lang.Exception
protected void serviceExtendTicket()
throws java.lang.Exception
newterm - the new term for the ticket
java.lang.Exception
protected void extendLease()
throws java.lang.Exception
java.lang.Exception
protected void serviceExtendLease()
throws java.lang.Exception
newterm - the new term for the ticket
java.lang.Exception
protected void updateTicket(ResourceReservation rarg,
UpdateData udd)
throws java.lang.Exception
rarg - the reservation being updatedudd - the new data
java.lang.Exception
protected void serviceUpdateTicket()
throws java.lang.Exception
rarg - the reservation being updatedudd - the new data
java.lang.Exception
protected void updateLease(ResourceReservation rarg,
UpdateData udd)
throws java.lang.Exception
rarg - the reservation being updatedudd - the new data
java.lang.Exception
protected void serviceUpdateLease()
throws java.lang.Exception
rarg - the reservation being updatedudd - the new data
java.lang.Exceptionprotected void close()
protected void serviceClose()
protected void prepareProbe()
throws java.lang.Exception
java.lang.Exception
protected void probe()
throws java.lang.Exception
java.lang.Exception
protected void probePending()
throws java.lang.Exception
java.lang.Exception
protected void serviceProbe()
throws java.lang.Exception
java.lang.Exception
protected void handleDuplicateRequest(int operation)
throws java.lang.Exception
operation - operation type code
java.lang.Exception
protected void ready()
throws java.lang.Exception
java.lang.Exception - thrown if the state is closed or failed
protected void nothingPending()
throws java.lang.Exception
java.lang.Exception
protected void validate()
throws java.lang.Exception
java.lang.Exception
protected void validateIncoming()
throws java.lang.Exception
java.lang.Exception
protected void validateOutgoing()
throws java.lang.Exception
java.lang.Exception
protected void internalError(java.lang.String err)
throws java.lang.Exception
err - error message
java.lang.Exceptionprotected void logRemoteError(java.lang.String err)
err - The error messageprotected void logError(java.lang.String err)
err - The error messageprotected void logWarning(java.lang.String err)
err - The error message
protected void logException(java.lang.String err,
java.lang.Exception e)
err - error messagee - exception
protected void error(java.lang.String err)
throws java.lang.Exception
err - The error message
java.lang.Exceptionpublic boolean isPriming()
IReservationStatus
isPriming in interface IReservationStatuspublic boolean isClosed()
IReservationStatus
isClosed in interface IReservationStatuspublic boolean isClosing()
IReservationStatus
isClosing in interface IReservationStatuspublic boolean isNascent()
IReservationStatus
isNascent in interface IReservationStatuspublic boolean isFailed()
IReservationStatus
isFailed in interface IReservationStatuspublic boolean isActive()
IReservationStatus
isActive in interface IReservationStatuspublic boolean isActiveTicketed()
IReservationStatus
isActiveTicketed in interface IReservationStatuspublic boolean isTicketed()
IReservationStatus
isTicketed in interface IReservationStatuspublic boolean isRedeeming()
IReservationStatus
isRedeeming in interface IReservationStatuspublic boolean isExtendingLease()
IReservationStatus
isExtendingLease in interface IReservationStatuspublic boolean isExtendingTicket()
IReservationStatus
isExtendingTicket in interface IReservationStatuspublic boolean isTicketing()
IReservationStatus
isTicketing in interface IReservationStatuspublic boolean isTerminal()
IReservationStatus
isTerminal in interface IReservationStatuspublic boolean isNoPending()
IReservationStatus
isNoPending in interface IReservationStatus
public void awaitActive()
throws java.lang.InterruptedException
IReservation
awaitActive in interface IReservationjava.lang.InterruptedException
public void awaitClosed()
throws java.lang.InterruptedException
IReservation
awaitClosed in interface IReservationjava.lang.InterruptedException
public void awaitTicketed()
throws java.lang.InterruptedException
IReservation
awaitTicketed in interface IReservationjava.lang.InterruptedExceptionprotected void clearNotice()
public void registerListener(IStateChangeListener l)
IReservation
registerListener in interface IReservationl - listener objectpublic void unregisterListener(IStateChangeListener l)
IReservation
unregisterListener in interface IReservationl - listener
public static ReservationID getReservationID(java.util.Properties p)
throws java.lang.Exception
p - properties list
java.lang.Exception - if the properties list does not contain a reservation
identifier
public static java.lang.String getSliceName(java.util.Properties p)
throws java.lang.Exception
p - properties list
java.lang.Exception - if the properties list does not contain a slice name
public static ResourceReservation createInstance(java.util.Properties p)
throws java.lang.Exception
p - properties list
java.lang.Exceptionpublic static int getCategory(java.util.Properties p)
p - properties list
public IActor getActor()
IReservation
getActor in interface IReservationprotected void setActor(IActor actor)
the - actor in control of the reservationpublic Slice getSlice()
IReservation
getSlice in interface IReservationpublic java.lang.String getSliceName()
public SliceID getSliceID()
protected Guard getGuard()
public void setSlice(Slice slice)
IReservation
setSlice in interface IReservationslice - slice the reservation belongs topublic int getCategory()
IReservation
getCategory in interface IReservationpublic ReservationID getReservationID()
IReservation
getReservationID in interface IReservationpublic boolean isExtended()
IReservationStatus
isExtended in interface IReservationStatuspublic int getState()
IReservation
getState in interface IReservationpublic java.lang.String getStateName()
IReservation
getStateName in interface IReservationpublic int getPendingState()
IReservation
getPendingState in interface IReservationpublic java.lang.String getPendingStateName()
IReservation
getPendingStateName in interface IReservationpublic ReservationState getReservationState()
IReservation
getReservationState in interface IReservationpublic ReservationState getPreviousReservationState()
IReservation
getPreviousReservationState in interface IReservationpublic boolean isDirty()
IReservation
isDirty in interface IReservationpublic boolean hasUncommittedTransition()
IReservation
hasUncommittedTransition in interface IReservationpublic void clearDirty()
IReservation
clearDirty in interface IReservationpublic void setDirty()
IReservation
setDirty in interface IReservationprotected void setLogger(LoggingTool logger)
logger - logger objectpublic void setExpired(boolean value)
IReservationStatus
setExpired in interface IReservationStatusvalue - true if the reservation is expiredpublic boolean isExpired()
IReservationStatus
isExpired in interface IReservationStatusprotected java.lang.String getNotice()
public long getCloseTime()
IReservation
getCloseTime in interface IReservationpublic void setCloseTime(long closeTime)
IReservation
setCloseTime in interface IReservation
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||