com.sun.enterprise.ee.cms.impl.base
Class GroupHandleImpl

java.lang.Object
  extended by com.sun.enterprise.ee.cms.impl.base.GroupHandleImpl
All Implemented Interfaces:
GroupHandle

public final class GroupHandleImpl
extends Object
implements GroupHandle

Implementation of GroupHandle interface.

Version:
$Revision: 1495 $
Author:
Shreedhar Ganapathy Date: Jan 12, 2004

Constructor Summary
GroupHandleImpl(String groupName, String serverToken)
           
 
Method Summary
 void announceWatchdogObservedFailure(String serverToken)
           
 List<String> getAllCurrentMembers()
          returns a List containing the current group membership including spectator members.
 List<String> getAllCurrentMembersWithStartTimes()
           
 AliveAndReadyView getCurrentAliveAndReadyCoreView()
           
 List<String> getCurrentAliveOrReadyMembers()
           
 List<String> getCurrentCoreMembers()
          returns a List containing the current core members in the group.
 List<String> getCurrentCoreMembersWithStartTimes()
           
 List<GMSMember> getCurrentView()
           
 DistributedStateCache getDistributedStateCache()
          returns a DistributedStateCache object that provides the ability to set and retrieve CachedStates.
 String getGroupLeader()
           
 MemberStates getMemberState(String member)
           
 MemberStates getMemberState(String member, long threshold, long timeout)
           
 AliveAndReadyView getPreviousAliveAndReadyCoreView()
           
 List<GMSMember> getPreviousView()
           
 List<String> getSuspectList()
           
 boolean isFenced(String componentName, String memberToken)
          Provides the status of a member component's fence, if any.
 boolean isGroupLeader()
           
 boolean isMemberAlive(String memberToken)
           
 boolean isWatchdog()
           
 void lowerFence(String componentName, String failedMemberToken)
          Enables the caller to lower a logical fence that was earlier raised on a target member component.
 void raiseFence(String componentName, String failedMemberToken)
          Enables the caller to raise a logical fence on a specified target member token's component.
 void removeRecoveryAppointments(String failedMemberToken, String componentName)
           
 void sendMessage(List<String> targetServerTokens, String targetComponentName, byte[] message)
           
 void sendMessage(String componentName, byte[] message)
          Sends a message to all members of the Group.
 void sendMessage(String targetServerToken, String targetComponentName, byte[] message)
          Sends a message to a single member of the group Expects a targetServerToken representing the recipient member's id, the target component name in the target recipient member, and a byte array as parameter carrying the payload.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GroupHandleImpl

public GroupHandleImpl(String groupName,
                       String serverToken)
Method Detail

sendMessage

public void sendMessage(String componentName,
                        byte[] message)
                 throws GMSException
Sends a message to all members of the Group. Expects a byte array as parameter carrying the payload.

Specified by:
sendMessage in interface GroupHandle
Parameters:
componentName - Destination component in remote members.
message - Payload in byte array to be delivered to the destination.
Throws:
GMSException

sendMessage

public void sendMessage(String targetServerToken,
                        String targetComponentName,
                        byte[] message)
                 throws GMSException
Sends a message to a single member of the group Expects a targetServerToken representing the recipient member's id, the target component name in the target recipient member, and a byte array as parameter carrying the payload. Specifying a null component name would result in the message being delivered to all registered components in the target member instance.

Specified by:
sendMessage in interface GroupHandle
Parameters:
targetServerToken - destination member's identification
targetComponentName - destination member's target component
message - Payload in byte array to be delivered to the destination.
Throws:
GMSException

sendMessage

public void sendMessage(List<String> targetServerTokens,
                        String targetComponentName,
                        byte[] message)
                 throws GMSException
Specified by:
sendMessage in interface GroupHandle
Throws:
GMSException

getDistributedStateCache

public DistributedStateCache getDistributedStateCache()
returns a DistributedStateCache object that provides the ability to set and retrieve CachedStates.

Specified by:
getDistributedStateCache in interface GroupHandle
Returns:
DistributedStateCache
See Also:
DistributedStateCache

getCurrentCoreMembers

public List<String> getCurrentCoreMembers()
returns a List containing the current core members in the group.

Specified by:
getCurrentCoreMembers in interface GroupHandle
Returns:
List a List of member token ids pertaining to core members

getAllCurrentMembers

public List<String> getAllCurrentMembers()
returns a List containing the current group membership including spectator members.

Specified by:
getAllCurrentMembers in interface GroupHandle
Returns:
List a List of member token ids pertaining to all members

getCurrentCoreMembersWithStartTimes

public List<String> getCurrentCoreMembersWithStartTimes()
Specified by:
getCurrentCoreMembersWithStartTimes in interface GroupHandle

getAllCurrentMembersWithStartTimes

public List<String> getAllCurrentMembersWithStartTimes()
Specified by:
getAllCurrentMembersWithStartTimes in interface GroupHandle

raiseFence

public void raiseFence(String componentName,
                       String failedMemberToken)
                throws GMSException
Enables the caller to raise a logical fence on a specified target member token's component. This API is directly called only when a component is raising a fence itself and not as part of acquiring a signal. If this is part of acquiring a signal, then the call should be to signal.acquire() which encompasses raising a fence and potentially other state updates.

Failure Fencing is a group-wide protocol that, on one hand, requires members to update a shared/distributed datastructure if any of their components need to perform operations on another members' corresponding component. On the other hand, the group-wide protocol requires members to observe "Netiquette" during their startup so as to check if any of their components are being operated upon by other group members. Typically this check is performed by the respective components themselves. See the isFenced() method below for this check. When the operation is completed by the remote member component, it removes the entry from the shared datastructure. See the lowerFence() method below.

Raising the fence, places an entry into a distributed datastructure that is accessed by other members during their startup

Specified by:
raiseFence in interface GroupHandle
Parameters:
componentName -
failedMemberToken -
Throws:
GMSException

lowerFence

public void lowerFence(String componentName,
                       String failedMemberToken)
                throws GMSException
Enables the caller to lower a logical fence that was earlier raised on a target member component. This is typically done when the operation being performed on the target member component has now completed. This api is directly called only by a component that is lowering a fence directly and not as part of releasing a signal. If the operation is to release a signal, then the appropriate call is to signal.release() which encompasses lowering the fence and other cleanups.

Specified by:
lowerFence in interface GroupHandle
Parameters:
componentName - target member component
failedMemberToken -
Throws:
GMSException

removeRecoveryAppointments

public void removeRecoveryAppointments(String failedMemberToken,
                                       String componentName)
                                throws GMSException
Specified by:
removeRecoveryAppointments in interface GroupHandle
Throws:
GMSException

isFenced

public boolean isFenced(String componentName,
                        String memberToken)
Provides the status of a member component's fence, if any.

This check is mandatorily done at the time a member component is in the process of starting(note that at this point we assume that this member failed in its previous lifetime).

The boolean value returned would indicate if this member component is being recovered by any other member. The criteria for returning a boolean "true" is that this componentName-memberToken combo is present as a value for any key in the GMS DistributedStateCache. If a true is returned, for instance, this could mean that the client component should continue its startup without attempting to perform its own recovery operations.

The criteria for returning a boolean "false" is that the componentId-memberTokenId combo is not present in the list of values in the DistributedStateCache.If a boolean "false" is returned, this could mean that the client component can continue with its lifecycle startup per its normal startup policies.

Specified by:
isFenced in interface GroupHandle
Parameters:
componentName -
memberToken -
Returns:
boolean

isMemberAlive

public boolean isMemberAlive(String memberToken)
Specified by:
isMemberAlive in interface GroupHandle

getGroupLeader

public String getGroupLeader()
Specified by:
getGroupLeader in interface GroupHandle

isGroupLeader

public boolean isGroupLeader()
Specified by:
isGroupLeader in interface GroupHandle

getSuspectList

public List<String> getSuspectList()

toString

public String toString()
Overrides:
toString in class Object

getCurrentAliveOrReadyMembers

public List<String> getCurrentAliveOrReadyMembers()
Specified by:
getCurrentAliveOrReadyMembers in interface GroupHandle

getMemberState

public MemberStates getMemberState(String member)
Specified by:
getMemberState in interface GroupHandle

getMemberState

public MemberStates getMemberState(String member,
                                   long threshold,
                                   long timeout)
Specified by:
getMemberState in interface GroupHandle

isWatchdog

public boolean isWatchdog()

announceWatchdogObservedFailure

public void announceWatchdogObservedFailure(String serverToken)
                                     throws GMSException
Specified by:
announceWatchdogObservedFailure in interface GroupHandle
Throws:
GMSException

getCurrentView

public List<GMSMember> getCurrentView()
Specified by:
getCurrentView in interface GroupHandle

getPreviousView

public List<GMSMember> getPreviousView()
Specified by:
getPreviousView in interface GroupHandle

getPreviousAliveAndReadyCoreView

public AliveAndReadyView getPreviousAliveAndReadyCoreView()
Specified by:
getPreviousAliveAndReadyCoreView in interface GroupHandle

getCurrentAliveAndReadyCoreView

public AliveAndReadyView getCurrentAliveAndReadyCoreView()
Specified by:
getCurrentAliveAndReadyCoreView in interface GroupHandle


Copyright © 2012. All Rights Reserved.