com.sun.sgs.impl.service.nodemap.policy
Class LocalNodePolicy

java.lang.Object
  extended by com.sun.sgs.impl.service.nodemap.policy.AbstractNodePolicy
      extended by com.sun.sgs.impl.service.nodemap.policy.RoundRobinPolicy
          extended by com.sun.sgs.impl.service.nodemap.policy.LocalNodePolicy
All Implemented Interfaces:
NodeAssignPolicy

public class LocalNodePolicy
extends RoundRobinPolicy

The simpliest node policy possible: always assign to the local requesting node. Round robin assignment is used when the server is making the request due to node failure.


Field Summary
 
Fields inherited from class com.sun.sgs.impl.service.nodemap.policy.AbstractNodePolicy
availableNodes
 
Fields inherited from interface com.sun.sgs.impl.service.nodemap.NodeAssignPolicy
SERVER_NODE
 
Constructor Summary
LocalNodePolicy(Properties props)
          Creates a new instance of the LocalNodePolicy, which always assigns an identity to the node which requested an assignment be made.
 
Method Summary
 long chooseNode(long requestingNode)
          Choose a node to assign an identity, or set of identities to.
 
Methods inherited from class com.sun.sgs.impl.service.nodemap.policy.AbstractNodePolicy
chooseNode, nodeAvailable, nodeUnavailable, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalNodePolicy

public LocalNodePolicy(Properties props)
Creates a new instance of the LocalNodePolicy, which always assigns an identity to the node which requested an assignment be made.

Parameters:
props - service properties
Method Detail

chooseNode

public long chooseNode(long requestingNode)
                throws NoNodesAvailableException
Choose a node to assign an identity, or set of identities to.

This implementation simply assigns to the node making the request. Round robin assignment is used if the server is making the request (due to reassigning identities from a failed node).

Specified by:
chooseNode in interface NodeAssignPolicy
Overrides:
chooseNode in class RoundRobinPolicy
Parameters:
requestingNode - the id of the node making the request, or SERVER_NODE if the system is making the request
Returns:
the chosen node's id
Throws:
NoNodesAvailableException - if there are no live nodes to assign to

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