com.sun.sgs.impl.service.nodemap.affinity.dgb
Class DistGraphBuilderServerImpl

java.lang.Object
  extended by com.sun.sgs.impl.service.nodemap.affinity.BasicState
      extended by com.sun.sgs.impl.service.nodemap.affinity.graph.AbstractAffinityGraphBuilder
          extended by com.sun.sgs.impl.service.nodemap.affinity.dgb.DistGraphBuilderServerImpl
All Implemented Interfaces:
AffinityGroupFinder, DistGraphBuilderServer, AffinityGraphBuilder, LPAAffinityGroupFinder, Remote

public class DistGraphBuilderServerImpl
extends AbstractAffinityGraphBuilder
implements DistGraphBuilderServer, AffinityGraphBuilder, LPAAffinityGroupFinder

The server side of a distributed graph builder for label propagation. It builds a single graph representing all information for the entire system using the single node graph builder, and uses a single node label propagation implementation to process the graph. This LPA implementation is expected to be useful for simple multi-node testing. It may have scalability problems due to the amount of data being sent from each node, and the size of the affinity graph and related data structures. It has no dependencies on new multi-node parts of the system.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.sun.sgs.impl.service.nodemap.affinity.BasicState
BasicState.State
 
Field Summary
static int DEFAULT_SERVER_PORT
          The default value of the server port.
static String SERVER_EXPORT_NAME
          The name we export ourselves under.
static String SERVER_PORT_PROPERTY
          The property name for the server port.
 
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
DistGraphBuilderServerImpl(ComponentRegistry systemRegistry, TransactionProxy txnProxy, Properties properties, long nodeId)
          Creates a distributed graph builder server.
 
Method Summary
 void disable()
          Disables this builder.
 void enable()
          Enables this builder.
 NavigableSet<RelocatingAffinityGroup> findAffinityGroups()
          Finds affinity groups across all nodes in the Darkstar cluster.
 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.
 Runnable getPruneTask()
          Get the task which prunes the graph.
 LabelVertex getVertex(Identity id)
          Gets the graph vertex for the given Identity.
 void shutdown()
          Shuts down this builder.
 void updateGraph(Identity owner, AccessedObjectsDetail detail)
          Update the graph based on the objects accessed in a task.
 void updateGraph(Identity owner, Object[] objIds)
          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
 

Field Detail

SERVER_PORT_PROPERTY

public static final String SERVER_PORT_PROPERTY
The property name for the server port.

See Also:
Constant Field Values

DEFAULT_SERVER_PORT

public static final int DEFAULT_SERVER_PORT
The default value of the server port.

See Also:
Constant Field Values

SERVER_EXPORT_NAME

public static final String SERVER_EXPORT_NAME
The name we export ourselves under.

See Also:
Constant Field Values
Constructor Detail

DistGraphBuilderServerImpl

DistGraphBuilderServerImpl(ComponentRegistry systemRegistry,
                           TransactionProxy txnProxy,
                           Properties properties,
                           long nodeId)
                     throws Exception
Creates a distributed graph builder server.

Parameters:
systemRegistry - the registry of available system components
txnProxy - the transaction proxy
properties - application properties
nodeId - the core server node id
Throws:
Exception - if an error occurs
Method Detail

updateGraph

public void updateGraph(Identity owner,
                        Object[] objIds)
Update the graph based on the objects accessed in a task.

Specified by:
updateGraph in interface DistGraphBuilderServer
Parameters:
owner - the task owner (the object making the accesses)
objIds - the object IDs of objects accessed by the owner

disable

public void disable()
Disables this builder. Disabled builders can be enabled or shutdown. Multiple calls to disable are allowed.

While disabled, no new graph updates are applied, but the graph pruners continue to discard old data.

Specified by:
disable in interface AffinityGroupFinder
Specified by:
disable in interface AffinityGraphBuilder

enable

public void enable()
Enables this builder. Enabled builders can be disabled or shutdown. Multiple calls to enable are allowed.

Specified by:
enable in interface AffinityGroupFinder
Specified by:
enable in interface AffinityGraphBuilder

shutdown

public void shutdown()
Shuts down this builder. Once shut down, a builder cannot be enabled or disabled. Multiple calls to shutdown are allowed.

Specified by:
shutdown in interface AffinityGroupFinder
Specified by:
shutdown in interface AffinityGraphBuilder

getAffinityGroupFinder

public LPAAffinityGroupFinder getAffinityGroupFinder()
Returns the affinity group finder created by this builder, or null if none was created. Some algorithms only create the finder on the server node.

Specified by:
getAffinityGroupFinder in interface AffinityGraphBuilder
Returns:
the affinity group finder or null

updateGraph

public void updateGraph(Identity owner,
                        AccessedObjectsDetail detail)
Update the graph based on the objects accessed in a task. If the builder is disabled, does nothing.

Specified by:
updateGraph in interface AffinityGraphBuilder
Parameters:
owner - the task owner (the object making the accesses)
detail - detailed information about the object accesses, including a list of the accessed objects

getAffinityGraph

public 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. An empty graph will be returned if there is no affinity data collected.

The returned graph can not be modified.

Specified by:
getAffinityGraph in interface AffinityGraphBuilder
Returns:
the graph of access information

getVertex

public LabelVertex getVertex(Identity id)
Gets the graph vertex for the given Identity.

Specified by:
getVertex in interface AffinityGraphBuilder
Parameters:
id - an identity
Returns:
the graph vertex for the identity, or null if there is no such vertex

getPruneTask

public Runnable getPruneTask()
Get the task which prunes the graph. This is useful for testing.

Returns:
the runnable which prunes the graph.
Throws:
UnsupportedOperationException - if this builder does not support graph pruning.

findAffinityGroups

public NavigableSet<RelocatingAffinityGroup> findAffinityGroups()
                                                         throws AffinityGroupFinderFailedException
Finds affinity groups across all nodes in the Darkstar cluster. If no groups are found, an empty set is returned. If an error is encountered during a run, an AffinityGroupFinderFailedException is thrown. Errors include nodes not responding to server requests.

The returned groups contain node assignment information for the identities. This information is looked up from the node mapping service. Alternatively, we could create a new graph node type and track this information based on which application node called updateGraph. While this would be some work, it might be worthwhile to implement if we find this LPA implementation is useful in deployed systems.

Specified by:
findAffinityGroups in interface LPAAffinityGroupFinder
Returns:
the affinity groups, or an empty set if none are found
Throws:
AffinityGroupFinderFailedException - if there is an error

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved