org.jboss.ha.framework.interfaces
Class FamilyClusterInfoImpl

java.lang.Object
  extended by org.jboss.ha.framework.interfaces.FamilyClusterInfoImpl
All Implemented Interfaces:
FamilyClusterInfo

public class FamilyClusterInfoImpl
extends Object
implements FamilyClusterInfo

Default implementation of FamilyClusterInfo

Version:
$Revision: 83175 $
Author:
Sacha Labourey.
See Also:
FamilyClusterInfo, ClusteringTargetsRepository

Field Summary
 
Fields inherited from interface org.jboss.ha.framework.interfaces.FamilyClusterInfo
UNINITIALIZED_CURSOR
 
Constructor Summary
protected FamilyClusterInfoImpl(String familyName, List targets, long viewId)
           
 
Method Summary
 boolean currentMembershipInSyncWithViewId()
          Gets whether this object believes its current target list matches what the server-side used to generate the view id.
 boolean equals(Object o)
           
 long getCurrentViewId()
          Gets a shorthand identifier for the current cluster topology for the clustered service represented by this object.
 int getCursor()
          Gets a cursor indicating a position in the current list of targets.
 String getFamilyName()
           
 Object getObject()
          Gets an object that may be one of the members of the current list of targets.
 List getTargets()
          Returns an unmodifiable view of the target list.
 int hashCode()
           
 List removeDeadTarget(Object target)
          Remove the given target from the list of targets.
 void resetView()
          Force a reload of the view at the next invocation.
 int setCursor(int cursor)
          Sets a cursor indicating a position in the current list of targets.
 Object setObject(Object whatever)
          Sets the member of the current list of targets that "sticky" load balancing strategies that wish to coordinate between instances should use.
 String toString()
           
 List updateClusterInfo(List targets, long viewId)
          Updates the targets and the view id.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FamilyClusterInfoImpl

protected FamilyClusterInfoImpl(String familyName,
                                List targets,
                                long viewId)
Method Detail

getFamilyName

public String getFamilyName()
Specified by:
getFamilyName in interface FamilyClusterInfo

getTargets

public List getTargets()
Returns an unmodifiable view of the target list.

Specified by:
getTargets in interface FamilyClusterInfo
See Also:
Collections.unmodifiableList(List)

getCurrentViewId

public long getCurrentViewId()
Description copied from interface: FamilyClusterInfo
Gets a shorthand identifier for the current cluster topology for the clustered service represented by this object. The identifer is generated on the server side; clients can pass this view id to the server side to check whether their current view of the service topology matches what the server sees.

Specified by:
getCurrentViewId in interface FamilyClusterInfo

getCursor

public int getCursor()
Description copied from interface: FamilyClusterInfo
Gets a cursor indicating a position in the current list of targets. Useful for round-robin load balancing strategies that wish to coordinate between instances.

It is not guaranteed that the returned value will be less than the size of the target list; callers need to verify that themselves.

Specified by:
getCursor in interface FamilyClusterInfo
See Also:
FamilyClusterInfo.UNINITIALIZED_CURSOR, RoundRobin

setCursor

public int setCursor(int cursor)
Description copied from interface: FamilyClusterInfo
Sets a cursor indicating a position in the current list of targets. Useful for round-robin load balancing strategies that wish to coordinate between instances.

Specified by:
setCursor in interface FamilyClusterInfo

getObject

public Object getObject()
Description copied from interface: FamilyClusterInfo
Gets an object that may be one of the members of the current list of targets. Useful for "sticky" load balancing strategies that wish to coordinate between instances.

It is not guaranteed that the returned object will be a current member of the target list; callers need to verify that themselves.

Specified by:
getObject in interface FamilyClusterInfo
Returns:
an object that *may* be an element in the target list, or may be null
See Also:
FirstAvailableIdenticalAllProxies

setObject

public Object setObject(Object whatever)
Description copied from interface: FamilyClusterInfo
Sets the member of the current list of targets that "sticky" load balancing strategies that wish to coordinate between instances should use.

Specified by:
setObject in interface FamilyClusterInfo
Parameters:
whatever - *should* be a member of the current list of targets, or null. However, this requirement is not enforced.

removeDeadTarget

public List removeDeadTarget(Object target)
Description copied from interface: FamilyClusterInfo
Remove the given target from the list of targets. NOTE: Implementations should synchronize on themselves when executing this method (see JBAS-2071).

Specified by:
removeDeadTarget in interface FamilyClusterInfo
Parameters:
target - the target
Returns:
the updated list of targets

updateClusterInfo

public List updateClusterInfo(List targets,
                              long viewId)
Description copied from interface: FamilyClusterInfo
Updates the targets and the view id. NOTE: Implementations should synchronize on themselves when executing this method (see JBAS-2071).

Specified by:
updateClusterInfo in interface FamilyClusterInfo

currentMembershipInSyncWithViewId

public boolean currentMembershipInSyncWithViewId()
Description copied from interface: FamilyClusterInfo
Gets whether this object believes its current target list matches what the server-side used to generate the view id.

Generally, a call to FamilyClusterInfo.removeDeadTarget(Object) would cause this method to return false until a subsequent call to FamilyClusterInfo.updateClusterInfo(List, long) is made.

Specified by:
currentMembershipInSyncWithViewId in interface FamilyClusterInfo

resetView

public void resetView()
Description copied from interface: FamilyClusterInfo
Force a reload of the view at the next invocation. NOTE: Implementations should synchronize on themselves when executing this method (see JBAS-2071).

Specified by:
resetView in interface FamilyClusterInfo

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.