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

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.DistGraphBuilder
All Implemented Interfaces:
AffinityGraphBuilder

public class DistGraphBuilder
extends AbstractAffinityGraphBuilder
implements AffinityGraphBuilder

The portion of the distributed affinity graph builder which resides on a local node. This code forwards graph information to its server, which builds a single large graph for all information in the system.

If the server cannot be contacted, we report the failure to the watchdog.

The following properties are supported:

Property: com.sun.sgs.impl.service.nodemap.affinity.server.host
Default: the value of the com.sun.sgs.server.host property, if present, or localhost if this node is starting the server
The name of the host running the NodeMappingServer.

Property: com.sun.sgs.impl.service.nodemap.affinity.server.port
Default: 44537
The network port for the LabelPropagationServer. This value must be no less than 0 and no greater than 65535.

Property: com.sun.sgs.impl.service.nodemap.affinity.snapshot.period
Default: 300000 (5 minutes)
The amount of time, in milliseconds, for each snapshot of retained data. Older snapshots are discarded as time goes on. A longer snapshot period gives us more history, but also longer compute times to use that history, as more data must be processed.

Property: com.sun.sgs.impl.service.nodemap.affinity.snapshot.count
Default: 1
The number of snapshots to retain. A larger value means more history will be retained. Using a smaller snapshot period with a larger count means more total history will be retained, with a smaller amount discarded at the start of each new snapshot.


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
DistGraphBuilder(Properties properties, ComponentRegistry systemRegistry, TransactionProxy txnProxy)
          Creates the client side of a distributed 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.
 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.
 
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

DistGraphBuilder

public DistGraphBuilder(Properties properties,
                        ComponentRegistry systemRegistry,
                        TransactionProxy txnProxy)
                 throws Exception
Creates the client side of a distributed graph builder.

Parameters:
properties - the properties for configuring this builder
systemRegistry - the registry of available system components
txnProxy - the transaction proxy
Throws:
Exception - if an error occurs
Method Detail

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.

This implementation will always throw an UnsupportedOperationException, because the graph is not held on the local node.

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.

This implementation will always throw an UnsupportedOperationException, because the graph is not held on the local node.

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

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 AffinityGraphBuilder

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 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 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

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