Class GroupHandleImpl
- java.lang.Object
-
- com.sun.enterprise.ee.cms.impl.base.GroupHandleImpl
-
- All Implemented Interfaces:
com.sun.enterprise.ee.cms.core.GroupHandle
public final class GroupHandleImpl extends java.lang.Object implements com.sun.enterprise.ee.cms.core.GroupHandleImplementation of GroupHandle interface.- Version:
- $Revision$
- Author:
- Shreedhar Ganapathy Date: Jan 12, 2004
-
-
Constructor Summary
Constructors Constructor Description GroupHandleImpl(java.lang.String groupName, java.lang.String serverToken)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidannounceWatchdogObservedFailure(java.lang.String serverToken)java.util.List<java.lang.String>getAllCurrentMembers()returns a List containing the current group membership including spectator members.java.util.List<java.lang.String>getAllCurrentMembersWithStartTimes()com.sun.enterprise.ee.cms.core.AliveAndReadyViewgetCurrentAliveAndReadyCoreView()java.util.List<java.lang.String>getCurrentAliveOrReadyMembers()java.util.List<java.lang.String>getCurrentCoreMembers()returns a List containing the current core members in the group.java.util.List<java.lang.String>getCurrentCoreMembersWithStartTimes()java.util.List<com.sun.enterprise.ee.cms.core.GMSMember>getCurrentView()com.sun.enterprise.ee.cms.core.DistributedStateCachegetDistributedStateCache()returns a DistributedStateCache object that provides the ability to set and retrieve CachedStates.java.lang.StringgetGroupLeader()com.sun.enterprise.ee.cms.spi.MemberStatesgetMemberState(java.lang.String member)com.sun.enterprise.ee.cms.spi.MemberStatesgetMemberState(java.lang.String member, long threshold, long timeout)com.sun.enterprise.ee.cms.core.AliveAndReadyViewgetPreviousAliveAndReadyCoreView()java.util.List<com.sun.enterprise.ee.cms.core.GMSMember>getPreviousView()java.util.List<java.lang.String>getSuspectList()booleanisFenced(java.lang.String componentName, java.lang.String memberToken)Provides the status of a member component's fence, if any.booleanisGroupLeader()booleanisMemberAlive(java.lang.String memberToken)booleanisWatchdog()voidlowerFence(java.lang.String componentName, java.lang.String failedMemberToken)Enables the caller to lower a logical fence that was earlier raised on a target member component.voidraiseFence(java.lang.String componentName, java.lang.String failedMemberToken)Enables the caller to raise a logical fence on a specified target member token's component.voidremoveRecoveryAppointments(java.lang.String failedMemberToken, java.lang.String componentName)voidsendMessage(java.lang.String componentName, byte[] message)Sends a message to all members of the Group.voidsendMessage(java.lang.String targetServerToken, java.lang.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.voidsendMessage(java.util.List<java.lang.String> targetServerTokens, java.lang.String targetComponentName, byte[] message)java.lang.StringtoString()
-
-
-
Method Detail
-
sendMessage
public void sendMessage(java.lang.String componentName, byte[] message) throws com.sun.enterprise.ee.cms.core.GMSExceptionSends a message to all members of the Group. Expects a byte array as parameter carrying the payload.- Specified by:
sendMessagein interfacecom.sun.enterprise.ee.cms.core.GroupHandle- Parameters:
componentName- Destination component in remote members.message- Payload in byte array to be delivered to the destination.- Throws:
com.sun.enterprise.ee.cms.core.GMSException
-
sendMessage
public void sendMessage(java.lang.String targetServerToken, java.lang.String targetComponentName, byte[] message) throws com.sun.enterprise.ee.cms.core.GMSExceptionSends 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:
sendMessagein interfacecom.sun.enterprise.ee.cms.core.GroupHandle- Parameters:
targetServerToken- destination member's identificationtargetComponentName- destination member's target componentmessage- Payload in byte array to be delivered to the destination.- Throws:
com.sun.enterprise.ee.cms.core.GMSException
-
sendMessage
public void sendMessage(java.util.List<java.lang.String> targetServerTokens, java.lang.String targetComponentName, byte[] message) throws com.sun.enterprise.ee.cms.core.GMSException- Specified by:
sendMessagein interfacecom.sun.enterprise.ee.cms.core.GroupHandle- Throws:
com.sun.enterprise.ee.cms.core.GMSException
-
getDistributedStateCache
public com.sun.enterprise.ee.cms.core.DistributedStateCache getDistributedStateCache()
returns a DistributedStateCache object that provides the ability to set and retrieve CachedStates.- Specified by:
getDistributedStateCachein interfacecom.sun.enterprise.ee.cms.core.GroupHandle- Returns:
- DistributedStateCache
- See Also:
DistributedStateCache
-
getCurrentCoreMembers
public java.util.List<java.lang.String> getCurrentCoreMembers()
returns a List containing the current core members in the group.- Specified by:
getCurrentCoreMembersin interfacecom.sun.enterprise.ee.cms.core.GroupHandle- Returns:
- List a List of member token ids pertaining to core members
-
getAllCurrentMembers
public java.util.List<java.lang.String> getAllCurrentMembers()
returns a List containing the current group membership including spectator members.- Specified by:
getAllCurrentMembersin interfacecom.sun.enterprise.ee.cms.core.GroupHandle- Returns:
- List a List of member token ids pertaining to all members
-
getCurrentCoreMembersWithStartTimes
public java.util.List<java.lang.String> getCurrentCoreMembersWithStartTimes()
- Specified by:
getCurrentCoreMembersWithStartTimesin interfacecom.sun.enterprise.ee.cms.core.GroupHandle
-
getAllCurrentMembersWithStartTimes
public java.util.List<java.lang.String> getAllCurrentMembersWithStartTimes()
- Specified by:
getAllCurrentMembersWithStartTimesin interfacecom.sun.enterprise.ee.cms.core.GroupHandle
-
raiseFence
public void raiseFence(java.lang.String componentName, java.lang.String failedMemberToken) throws com.sun.enterprise.ee.cms.core.GMSExceptionEnables 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:
raiseFencein interfacecom.sun.enterprise.ee.cms.core.GroupHandle- Parameters:
componentName- the component namefailedMemberToken- the member token- Throws:
com.sun.enterprise.ee.cms.core.GMSException- the GMS generic exception
-
lowerFence
public void lowerFence(java.lang.String componentName, java.lang.String failedMemberToken) throws com.sun.enterprise.ee.cms.core.GMSExceptionEnables 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:
lowerFencein interfacecom.sun.enterprise.ee.cms.core.GroupHandle- Parameters:
componentName- target member componentfailedMemberToken- the member token of the failed member- Throws:
com.sun.enterprise.ee.cms.core.GMSException- the GMS Generic Exception
-
removeRecoveryAppointments
public void removeRecoveryAppointments(java.lang.String failedMemberToken, java.lang.String componentName) throws com.sun.enterprise.ee.cms.core.GMSException- Specified by:
removeRecoveryAppointmentsin interfacecom.sun.enterprise.ee.cms.core.GroupHandle- Throws:
com.sun.enterprise.ee.cms.core.GMSException
-
isFenced
public boolean isFenced(java.lang.String componentName, java.lang.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:
isFencedin interfacecom.sun.enterprise.ee.cms.core.GroupHandle- Parameters:
componentName- the component namememberToken- the member token- Returns:
- boolean
-
isMemberAlive
public boolean isMemberAlive(java.lang.String memberToken)
- Specified by:
isMemberAlivein interfacecom.sun.enterprise.ee.cms.core.GroupHandle
-
getGroupLeader
public java.lang.String getGroupLeader()
- Specified by:
getGroupLeaderin interfacecom.sun.enterprise.ee.cms.core.GroupHandle
-
isGroupLeader
public boolean isGroupLeader()
- Specified by:
isGroupLeaderin interfacecom.sun.enterprise.ee.cms.core.GroupHandle
-
getSuspectList
public java.util.List<java.lang.String> getSuspectList()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getCurrentAliveOrReadyMembers
public java.util.List<java.lang.String> getCurrentAliveOrReadyMembers()
- Specified by:
getCurrentAliveOrReadyMembersin interfacecom.sun.enterprise.ee.cms.core.GroupHandle
-
getMemberState
public com.sun.enterprise.ee.cms.spi.MemberStates getMemberState(java.lang.String member)
- Specified by:
getMemberStatein interfacecom.sun.enterprise.ee.cms.core.GroupHandle
-
getMemberState
public com.sun.enterprise.ee.cms.spi.MemberStates getMemberState(java.lang.String member, long threshold, long timeout)- Specified by:
getMemberStatein interfacecom.sun.enterprise.ee.cms.core.GroupHandle
-
isWatchdog
public boolean isWatchdog()
-
announceWatchdogObservedFailure
public void announceWatchdogObservedFailure(java.lang.String serverToken) throws com.sun.enterprise.ee.cms.core.GMSException- Specified by:
announceWatchdogObservedFailurein interfacecom.sun.enterprise.ee.cms.core.GroupHandle- Throws:
com.sun.enterprise.ee.cms.core.GMSException
-
getCurrentView
public java.util.List<com.sun.enterprise.ee.cms.core.GMSMember> getCurrentView()
- Specified by:
getCurrentViewin interfacecom.sun.enterprise.ee.cms.core.GroupHandle
-
getPreviousView
public java.util.List<com.sun.enterprise.ee.cms.core.GMSMember> getPreviousView()
- Specified by:
getPreviousViewin interfacecom.sun.enterprise.ee.cms.core.GroupHandle
-
getPreviousAliveAndReadyCoreView
public com.sun.enterprise.ee.cms.core.AliveAndReadyView getPreviousAliveAndReadyCoreView()
- Specified by:
getPreviousAliveAndReadyCoreViewin interfacecom.sun.enterprise.ee.cms.core.GroupHandle
-
getCurrentAliveAndReadyCoreView
public com.sun.enterprise.ee.cms.core.AliveAndReadyView getCurrentAliveAndReadyCoreView()
- Specified by:
getCurrentAliveAndReadyCoreViewin interfacecom.sun.enterprise.ee.cms.core.GroupHandle
-
-