|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorca.cod.control.IdControlChange
public class IdControlChange
Site authority assignment policy, which follows strictly broker allocation. Current limitation:
| Nested Class Summary | |
|---|---|
class |
IdControlChange.ControlState
|
| Field Summary | |
|---|---|
protected IActor |
actor
The actor this control belongs to |
protected IAuthority |
authority
The actor, cast to a SlottedAuthority (for convenience) |
protected AuthorityCalendar |
calendar
The actor calendar |
protected ID |
guid
|
protected java.util.Hashtable<ID,Machine> |
identifiers
Mapping of logical identifiers to machines |
static int |
IndexBandwidth
|
static int |
IndexCpu
|
static int |
IndexMemory
|
static int |
IndexStorage
|
protected long |
inplace
|
protected boolean |
lazyClose
True if we are using lazy revocation of leased resources |
protected LoggingTool |
logger
|
protected java.util.HashMap<NodeID,Machine> |
machines
Set of all donated machines. |
protected java.util.ArrayList<Machine> |
machinesFailed
Machines that host un-released/failed resources |
protected java.util.ArrayList<Machine> |
machinesFree
Machines not in use |
protected java.util.ArrayList<Machine> |
machinesHosting
Physical machines currently in use |
protected long |
migrations
|
protected java.util.Hashtable<NodeID,Node> |
nodes
|
static java.lang.String |
PropertyBandwidth
|
static java.lang.String |
PropertyCpu
|
static java.lang.String |
PropertyDimensions
|
static java.lang.String |
PropertyGuid
|
static java.lang.String |
PropertyMaxPrefix
|
static java.lang.String |
PropertyMemory
|
static java.lang.String |
PropertyNamePrefix
|
static java.lang.String |
PropertyResourceType
|
static java.lang.String |
PropertyStorage
|
protected long |
restores
|
protected long |
saves
|
protected ResourceType |
type
|
| Constructor Summary | |
|---|---|
IdControlChange()
|
|
| Method Summary | |
|---|---|
protected NodeGroup |
allocateNodes(java.util.Vector<ID> ids,
long[] shares,
AuthorityReservation reservation)
Allocates new nodes |
ResourceSet |
assign(AuthorityReservation r)
|
void |
available(ResourceSet set)
|
void |
calculateChanges(NodeGroup current,
java.util.Vector<ID> ids,
NodeSet inList,
NodeSet notInList,
java.util.Vector<ID> newIds)
This function calculates the difference between the current association of nodes and logicalIds and the new association received with the extend request. |
protected void |
checkLazyClose(Machine m)
Checks if this machine contains nodes from expired reservations. |
void |
configure(java.util.Properties p)
|
protected java.lang.String |
convert(long[] data)
Converts and array to a string |
ResourceSet |
correctDeficit(AuthorityReservation r)
|
ResourceSet |
correctFailed(ResourceSet rset)
|
void |
donate(ResourceSet set)
Note: must be able to handle multiple donates of the same resources |
java.lang.String |
dumpStats()
|
void |
eject(ResourceSet set)
|
protected void |
fail(Machine host)
|
protected int |
findIndex(java.util.ArrayList<Machine> machines,
Node n)
|
protected void |
forceClose(NodeGroup lost)
Forces the nodes in this group to be lost |
void |
freed(ResourceSet r)
|
protected AuthorityCodDatabase |
getDb()
|
protected long[] |
getGrowing(long[] difference)
Returns max(difference[i],0) |
ID |
getGuid()
|
protected java.util.Vector<ID> |
getIdentifiers(java.util.Properties p)
Extracts identifiers from the specified properties list |
protected java.util.Vector<ID> |
getIds(NodeGroup currentNodes)
Returns the logical ids of the nodes contained in this nodegroup |
protected int |
getInUse()
|
protected Machine |
getMachine(ID id)
Returns the machine associated with the given logical id |
protected Machine |
getMachineForNodeRevisit(Node node)
Obtains the host machine for the given node during recovery. |
protected java.util.Vector<ID> |
getNewIds(java.util.Vector<ID> ids,
NodeGroup currentNodes)
Returns a hashtable of the identifiers not present in the node group |
protected AuthorityReservation |
getReservation(Node node)
|
protected long[] |
getShares(Node n)
Extracts the shares from the specified node |
protected long[] |
getShares(java.util.Properties p)
Extracts the shares from the specified properties list |
IdControlChange.ControlState |
getState()
|
protected NodeSet |
getToModify(NodeGroup currentNodes,
NodeGroup lost)
Returns the difference between currentNodes and lost |
ResourceType[] |
getTypes()
|
protected boolean |
handleChangedIds(NodeSet nodes,
java.util.Vector<ID> ids,
AuthorityReservation reservation)
Schedules migrations (saves) for the nodes that have changed their identifiers. |
protected void |
handleRelease(java.util.Iterator iter)
|
protected boolean |
hasChanged(long[] current,
long[] requested)
Returns true if the passed resource specifications are different |
void |
initialize()
Initializes the object. |
protected boolean |
inProgress(AuthorityReservation r)
Determines if there are nodes in this reservation that have pending modify/close operation |
protected boolean |
isExpired(AuthorityReservation r,
long now)
Checks if the specified reservation has expired |
protected NodeGroup |
modify(AuthorityReservation r,
NodeSet inList,
long[] capacity)
Modify all nodes u |
protected boolean |
pendingRestore(AuthorityReservation r)
Checks if nodes in this reservation need to be restored |
protected void |
release(Node node,
boolean remove)
|
protected void |
release(NodeGroup group)
|
protected void |
release(NodeGroup group,
boolean remove)
|
void |
release(ResourceSet r)
|
protected void |
releaseClosed(Node node)
|
protected void |
releaseMigrated(Node node)
|
protected void |
releaseResized(Node node)
|
protected void |
releaseSaved(Node node)
|
protected boolean |
reserveHostSharesRevisit(Machine host,
Node node)
|
void |
reset(java.util.Properties properties)
De-serializes the object from the given properties list. |
void |
revisit(IActor actor,
java.util.Properties properties)
Recovers state of the component using a previously saved properties list and a references to the actor this component belongs to. |
void |
revisit(ResourceReservation r)
|
protected void |
revisitModify(Node n)
|
java.util.Properties |
save()
Serializes the object into a properties list. |
void |
save(java.util.Properties properties)
Serializes the object into the given properties list. |
protected NodeGroup |
selectExtract(NodeSet inList,
NodeSet notInList,
int count,
java.util.Properties p)
Removes count nodes from the given set and places them in a nodegroup. |
NodeGroup |
selectExtract(java.util.Vector<ID> ids,
IConcreteSet current)
For use in selecting victims from a shrinking cluster. |
void |
setActor(IActor actor)
|
protected void |
setShares(NodeGroup group,
long[] shares)
Sets the shares for all nodes in this group |
protected void |
setShares(Node node,
long[] shares)
Sets the shares for the given node |
void |
setType(ResourceType type)
|
protected long[] |
subtract(long[] a,
long[] b)
Subtracts a from b |
int |
unavailable(ResourceSet set)
|
protected boolean |
zero(long[] shares)
Checks if the array contains only zero entries |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PropertyResourceType
public static final int IndexMemory
public static final int IndexCpu
public static final int IndexBandwidth
public static final int IndexStorage
public static final java.lang.String PropertyMemory
public static final java.lang.String PropertyCpu
public static final java.lang.String PropertyBandwidth
public static final java.lang.String PropertyStorage
public static final java.lang.String PropertyDimensions
public static final java.lang.String PropertyNamePrefix
public static final java.lang.String PropertyMaxPrefix
public static final java.lang.String PropertyGuid
protected long inplace
protected long restores
protected long migrations
protected long saves
protected boolean lazyClose
protected ID guid
protected java.util.HashMap<NodeID,Machine> machines
protected java.util.Hashtable<ID,Machine> identifiers
protected java.util.ArrayList<Machine> machinesHosting
protected java.util.ArrayList<Machine> machinesFree
protected java.util.ArrayList<Machine> machinesFailed
protected IActor actor
protected IAuthority authority
protected AuthorityCalendar calendar
protected LoggingTool logger
protected ResourceType type
protected java.util.Hashtable<NodeID,Node> nodes
| Constructor Detail |
|---|
public IdControlChange()
| Method Detail |
|---|
public void initialize()
throws java.lang.Exception
IInitialize
initialize in interface IInitializejava.lang.Exceptionprotected AuthorityCodDatabase getDb()
public IdControlChange.ControlState getState()
public void donate(ResourceSet set)
throws java.lang.Exception
donate in interface IResourceControljava.lang.Exception
protected int findIndex(java.util.ArrayList<Machine> machines,
Node n)
public void eject(ResourceSet set)
throws java.lang.Exception
eject in interface IResourceControljava.lang.Exception
public int unavailable(ResourceSet set)
throws java.lang.Exception
unavailable in interface IResourceControljava.lang.Exception
public void available(ResourceSet set)
throws java.lang.Exception
available in interface IResourceControljava.lang.Exception
public ResourceSet assign(AuthorityReservation r)
throws java.lang.Exception
assign in interface IResourceControljava.lang.Exception
public ResourceSet correctDeficit(AuthorityReservation r)
throws java.lang.Exception
correctDeficit in interface IResourceControljava.lang.Exception
public void freed(ResourceSet r)
throws java.lang.Exception
freed in interface IResourceControljava.lang.Exception
public void release(ResourceSet r)
throws java.lang.Exception
release in interface IResourceControljava.lang.Exception
protected void handleRelease(java.util.Iterator iter)
throws java.lang.Exception
java.lang.Exception
protected Machine getMachine(ID id)
throws java.lang.Exception
id -
java.lang.Exceptionprotected AuthorityReservation getReservation(Node node)
protected boolean isExpired(AuthorityReservation r,
long now)
r - Reservationnow - Current cycleprotected void checkLazyClose(Machine m)
m -
protected NodeGroup allocateNodes(java.util.Vector<ID> ids,
long[] shares,
AuthorityReservation reservation)
throws java.lang.Exception
ids - list of logical ids to usecount - number of machines to allocate (seems redundant)shares - resource sharesreservation - for which reservation
java.lang.Exception - if an error occursprotected boolean zero(long[] shares)
shares -
protected NodeGroup modify(AuthorityReservation r,
NodeSet inList,
long[] capacity)
throws java.lang.Exception
r - nodes - newIds - capacity - currentCapacity -
java.lang.Exception
protected void releaseMigrated(Node node)
throws java.lang.Exception
java.lang.Exception
protected void releaseSaved(Node node)
throws java.lang.Exception
java.lang.Exception
protected void releaseResized(Node node)
throws java.lang.Exception
java.lang.Exception
protected void releaseClosed(Node node)
throws java.lang.Exception
java.lang.Exceptionprotected boolean inProgress(AuthorityReservation r)
protected boolean pendingRestore(AuthorityReservation r)
throws java.lang.Exception
r - the reservation
java.lang.Exceptionprotected void forceClose(NodeGroup lost)
lost - protected java.util.Vector<ID> getIds(NodeGroup currentNodes)
currentNodes -
protected java.util.Vector<ID> getNewIds(java.util.Vector<ID> ids,
NodeGroup currentNodes)
ids - currentNodes -
protected boolean handleChangedIds(NodeSet nodes,
java.util.Vector<ID> ids,
AuthorityReservation reservation)
throws java.lang.Exception
nodes - nodes with changed identifiersids - the new identifiers to usecurrentShares -
java.lang.Exceptionprotected void release(NodeGroup group)
protected void release(NodeGroup group,
boolean remove)
throws java.lang.Exception
java.lang.Exception
protected void release(Node node,
boolean remove)
throws java.lang.Exception
java.lang.Exception
public void calculateChanges(NodeGroup current,
java.util.Vector<ID> ids,
NodeSet inList,
NodeSet notInList,
java.util.Vector<ID> newIds)
current - The nodes currently assigned to the reservationids - The ids received with the extend listnotInList - A set of nodes whose logical id is not in ids [used
output should be created (empty) by the caller]newIds - A list of new ids (not in
protected NodeGroup selectExtract(NodeSet inList,
NodeSet notInList,
int count,
java.util.Properties p)
throws java.lang.Exception
inList - notInList - count - currentShares - p -
java.lang.Exceptionprotected java.lang.String convert(long[] data)
data -
protected boolean hasChanged(long[] current,
long[] requested)
current - requested -
protected java.util.Vector<ID> getIdentifiers(java.util.Properties p)
throws java.lang.Exception
p -
java.lang.Exception
protected long[] getShares(java.util.Properties p)
throws java.lang.Exception
p -
java.lang.Exceptionprotected long[] getShares(Node n)
n -
java.lang.Exception
protected void setShares(NodeGroup group,
long[] shares)
throws java.lang.Exception
group - shares -
java.lang.Exception
protected void setShares(Node node,
long[] shares)
node - shares -
protected long[] subtract(long[] a,
long[] b)
a - b -
protected long[] getGrowing(long[] difference)
difference -
protected int getInUse()
public java.lang.String dumpStats()
throws java.lang.Exception
java.lang.Exceptionprotected Machine getMachineForNodeRevisit(Node node)
node - the node
protected boolean reserveHostSharesRevisit(Machine host,
Node node)
throws java.lang.Exception
java.lang.Exceptionprotected void fail(Machine host)
protected void revisitModify(Node n)
throws java.lang.Exception
java.lang.Exception
public void revisit(ResourceReservation r)
throws java.lang.Exception
revisit in interface IResourceControljava.lang.Exceptionpublic void setActor(IActor actor)
setActor in interface IResourceControlpublic ResourceType[] getTypes()
getTypes in interface IResourceControl
public java.util.Properties save()
throws java.lang.Exception
ISerialize
save in interface ISerializejava.lang.Exception
public void save(java.util.Properties properties)
throws java.lang.Exception
ISerialize
save in interface ISerializeproperties - properties list to serialize the object into
java.lang.Exception
public void reset(java.util.Properties properties)
throws java.lang.Exception
ISerialize
reset in interface ISerializeproperties - properties list containing the serialized version of
the object
java.lang.Exception
public void revisit(IActor actor,
java.util.Properties properties)
throws java.lang.Exception
IRecover
revisit in interface IRecoveractor - actor object the component belongs toproperties - properties list containing configuration data about the
component
java.lang.Exception
public void configure(java.util.Properties p)
throws java.lang.Exception
java.lang.Exceptionpublic void setType(ResourceType type)
protected NodeSet getToModify(NodeGroup currentNodes,
NodeGroup lost)
throws java.lang.Exception
currentNodes - lost -
java.lang.Exception
public NodeGroup selectExtract(java.util.Vector<ID> ids,
IConcreteSet current)
throws java.lang.Exception
java.lang.Exception
public ResourceSet correctFailed(ResourceSet rset)
throws java.lang.Exception
correctFailed in interface IResourceControljava.lang.Exceptionpublic ID getGuid()
getGuid in interface IResourceControl
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||