|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.service.nodemap.affinity.BasicState
com.sun.sgs.impl.service.nodemap.affinity.graph.AbstractAffinityGraphBuilder
com.sun.sgs.impl.service.nodemap.affinity.dlpa.graph.WeightedGraphBuilder
public class WeightedGraphBuilder
A graph builder which builds an affinity graph consisting of identities as vertices and a single weighted edges representing objects used by both identities.
The data access information naturally forms a bipartite graph, with vertices being either identities or objects, and an edge connecting each identity which has accessed an object. However, we want a graph with vertices for identities, and edges representing object accesses between identities, so we need the bipartite graph to be folded.
We build the folded graph on the fly by keeping track of which objects have been used by which identities. Edges between identities are weighted, and represent the number of object accesses the two identities have in common.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.sun.sgs.impl.service.nodemap.affinity.BasicState |
|---|
BasicState.State |
| Field Summary |
|---|
| Fields inherited from class com.sun.sgs.impl.service.nodemap.affinity.graph.AbstractAffinityGraphBuilder |
|---|
DEFAULT_PERIOD, DEFAULT_PERIOD_COUNT, logger, PERIOD_COUNT_PROPERTY, PERIOD_PROPERTY, periodCount, PROP_BASE, snapshot, wrappedProps |
| Fields inherited from class com.sun.sgs.impl.service.nodemap.affinity.BasicState |
|---|
state |
| Constructor Summary | |
|---|---|
WeightedGraphBuilder(Properties properties,
ComponentRegistry systemRegistry,
TransactionProxy txnProxy)
Creates a weighted graph builder. |
|
| Method Summary | |
|---|---|
void |
disable()
Disables this builder. |
void |
enable()
Enables this builder. |
edu.uci.ics.jung.graph.UndirectedGraph<LabelVertex,WeightedEdge> |
getAffinityGraph()
Returns the current graph, with identities as vertices, and edges representing each object accessed by both identity endpoints. |
LPAAffinityGroupFinder |
getAffinityGroupFinder()
Returns the affinity group finder created by this builder, or null if none was created. |
Map<Long,Map<Object,Long>> |
getConflictMap()
Returns a map of detected cross node data conflicts. |
Map<Object,Map<Identity,Long>> |
getObjectUseMap()
Returns a map of local object uses to the identities that used the objects, and a count of the number of uses. |
Runnable |
getPruneTask()
Get the task which prunes the graph. |
LabelVertex |
getVertex(Identity id)
Gets the graph vertex for the given Identity. |
void |
noteConflictDetected(Object objId,
long nodeId,
boolean forUpdate)
TBD: This will be the implementation of our conflict detection listener. |
void |
removeNode(long nodeId)
Note that a node has failed. |
void |
shutdown()
Shuts down this builder. |
void |
updateGraph(Identity owner,
AccessedObjectsDetail detail)
Update the graph based on the objects accessed in a task. |
| Methods inherited from class com.sun.sgs.impl.service.nodemap.affinity.BasicState |
|---|
checkForDisabledOrShutdownState, checkForShutdownState, setDisabledState, setEnabledState, setShutdownState |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WeightedGraphBuilder(Properties properties,
ComponentRegistry systemRegistry,
TransactionProxy txnProxy)
throws Exception
properties - the properties for configuring this buildersystemRegistry - the registry of available system componentstxnProxy - the transaction proxy
Exception - if an error occurs| Method Detail |
|---|
public void updateGraph(Identity owner,
AccessedObjectsDetail detail)
This method is called by a single thread but must protect itself from changes to data structures made by the pruner.
updateGraph in interface AffinityGraphBuilderowner - the task owner (the object making the accesses)detail - detailed information about the object accesses, including
a list of the accessed objectspublic edu.uci.ics.jung.graph.UndirectedGraph<LabelVertex,WeightedEdge> getAffinityGraph()
The returned graph can not be modified.
getAffinityGraph in interface AffinityGraphBuilderpublic Map<Object,Map<Identity,Long>> getObjectUseMap()
getObjectUseMap in interface DLPAGraphBuilderpublic Map<Long,Map<Object,Long>> getConflictMap()
getConflictMap in interface DLPAGraphBuilderpublic void disable()
While disabled, no new graph updates are applied, but the graph pruners continue to discard old data.
disable in interface AffinityGraphBuilderpublic void enable()
enable in interface AffinityGraphBuilderpublic void shutdown()
shutdown in interface AffinityGraphBuilderpublic LabelVertex getVertex(Identity id)
Identity.
getVertex in interface AffinityGraphBuilderid - an identity
null if
there is no such vertexpublic LPAAffinityGroupFinder getAffinityGroupFinder()
null if none was created. Some algorithms only create
the finder on the server node.
getAffinityGroupFinder in interface AffinityGraphBuildernull
public void noteConflictDetected(Object objId,
long nodeId,
boolean forUpdate)
Note that forUpdate is currently not used.
objId - the object that was evictednodeId - the node that caused the evictionforUpdate - true if this eviction was for an update,
false if it was for read only accesspublic void removeNode(long nodeId)
nodeId is
unknown or has already been noted as failed.
removeNode in interface DLPAGraphBuildernodeId - the id of the failed nodepublic Runnable getPruneTask()
UnsupportedOperationException - if this builder does not support
graph pruning.
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||