com.sun.sgs.impl.service.nodemap.affinity
Class RelocatingAffinityGroup

java.lang.Object
  extended by com.sun.sgs.impl.service.nodemap.affinity.RelocatingAffinityGroup
All Implemented Interfaces:
AffinityGroup, Comparable

public class RelocatingAffinityGroup
extends Object
implements AffinityGroup, Comparable

Stub, to be replaced by Keith's version (used for testing until we merge).

An affinity group which can relocate its member identities to other nodes. Key ideas swiped from Keith's branch to help us with merging.

These affinity groups can span multiple nodes and will eventually relocate their members to a single node. There probably needs to be some external control of the relocation in case we merge affinity groups or find that an algorithm run returns a single group.


Constructor Summary
RelocatingAffinityGroup(long agid, Map<Identity,Long> identities, long generation)
          Creates a new affinity group containing node information.
 
Method Summary
 int compareTo(Object obj)
          
 boolean equals(Object obj)
          
 long getGeneration()
          Returns a generation number for this affinity group.
 long getId()
          Returns the affinity group identifier.
 Set<Identity> getIdentities()
          Returns the set of Identities which are members of this group.
 int hashCode()
          
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RelocatingAffinityGroup

public RelocatingAffinityGroup(long agid,
                               Map<Identity,Long> identities,
                               long generation)
Creates a new affinity group containing node information.

Parameters:
agid - the group id
identities - the identities and their nodes in the group
generation - the generation number of this group
Throws:
IllegalArgumentException - if identities is empty
Method Detail

compareTo

public int compareTo(Object obj)

Sorts based on the number of identities in the groups.

Specified by:
compareTo in interface Comparable

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object

getId

public long getId()
Returns the affinity group identifier.

Specified by:
getId in interface AffinityGroup
Returns:
the affinity group identifier

getIdentities

public Set<Identity> getIdentities()
Returns the set of Identities which are members of this group. The set will contain at least one member.

Specified by:
getIdentities in interface AffinityGroup
Returns:
the set of Identities which are members of this group

getGeneration

public long getGeneration()
Returns a generation number for this affinity group. Affinity groups in the same generation were created at approximately the same time, so they can be used as the set of communities found at that time. Affinity groups with the same identifier but different generations cannot be compared; they are independent.

Specified by:
getGeneration in interface AffinityGroup
Returns:
the generation number for this affinity group

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