Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.enterprise.ee.cms.core
Interface GroupHandle

All Known Implementing Classes:
  GroupHandleImpl

    public interface GroupHandle

Provides a handle to the interact with the membership group. Using this interface, applications can send messages to the group, to individual members or a list of members, and also to specific components within the target member or group. Provides a reference to the DistributedStateCache, and APIs for FailureFencing.

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

Method Summary
`void` | `announceWatchdogObservedFailure(String serverToken)` GMS WATCHDOG member reports `serverToken` has been observed to have failed to this GMS group.
`List<String>` | `getAllCurrentMembers()` returns a List of strings containing the current group membership including spectator members.
`List<String>` | `getAllCurrentMembersWithStartTimes()` returns a List of strings containing the current group membership including spectator members.
`List<String>` | `getCurrentAliveOrReadyMembers()` * returns only the members that are in ALIVE or READY state
`List<String>` | `getCurrentCoreMembers()` returns a List of strings containing the current core members in the group
`List<String>` | `getCurrentCoreMembersWithStartTimes()` returns a List of strings containing the current core members in the group.
`List<GMSMember>` | `getCurrentView()` Return a snapshot of members in current view.
`DistributedStateCache` | `getDistributedStateCache()` returns a DistributedStateCache object that provides the ability to set and retrieve CachedStates.
`String` | `getGroupLeader()` Return the leader of the group
`MemberStates` | `getMemberState(String member)` API for giving the state of the member Calls #getMemberState(String, long, long) with implementation default values for `threshold` and `timeout`.
`MemberStates` | `getMemberState(String member, long threshold, long timeout)` Returns the state of the member.
`List<GMSMember>` | `getPreviousView()` Return snapshot of members in previous view.
`boolean` | `isFenced(String componentName, String memberToken)` Provides the status of a member component's fence, if any.
`boolean` | `isGroupLeader()` This is a check to find out if this peer is a group leader.
`boolean` | `isMemberAlive(String memberToken)` Checks if a member is alive
`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` | `sendMessage(List<String> targetServerTokens, String targetComponentName, byte[] message)` Sends a message to a list of members in the group.
`void` | `sendMessage(String targetComponentName, 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.

Method Detail

### sendMessage

    void sendMessage(String targetComponentName,
                     byte[] message)
                     throws GMSException

  Sends a message to all members of the Group. Expects a target component name 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.

  Note: when utilizing multicast, message size should not exceed the underlying communication provider message limits (64K). When sending messages larger than the limit, consider sending the message to each individual member

  Parameters:
    `targetComponentName` - target name
    `message` - the message to send
  Throws:
    `GMSException` - - any exception while sending message wrapped into GMSException

### sendMessage

    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.

  Parameters:
    `targetServerToken` - targetServerToken representing the recipient member's id
    `targetComponentName` - target name
    `message` - the message to send
  Throws:
    `GMSException` - - any exception while sending message wrapped into GMSException

### sendMessage

    void sendMessage(List<String> targetServerTokens,
                     String targetComponentName,
                     byte[] message)
                     throws GMSException

  Sends a message to a list of members in the group. An empty list would have the same effect as sending the message to the entire group

  Parameters:
    `targetServerTokens` - List of target server tokens
    `targetComponentName` - a component in the target members to which message is addressed.
    `message` - - the payload
  Throws:
    `GMSException` - - any exception while sending message wrapped into GMSException

### getDistributedStateCache

    DistributedStateCache getDistributedStateCache()

  returns a DistributedStateCache object that provides the ability to set and retrieve CachedStates.

  Returns:
    DistributedStateCache
  See Also:
    `DistributedStateCache`

### getCurrentCoreMembers

    List<String> getCurrentCoreMembers()

  returns a List of strings containing the current core members in the group

  Returns:
    List

### getCurrentAliveOrReadyMembers

    List<String> getCurrentAliveOrReadyMembers()

  * returns only the members that are in ALIVE or READY state

  Returns:
    List

### getMemberState

    MemberStates getMemberState(String member)

  API for giving the state of the member Calls #getMemberState(String, long, long) with implementation default values for `threshold` and `timeout`.

  Parameters:
    `member` - the group member
  Returns:
    the state of the `member`.

### getMemberState

    MemberStates getMemberState(String member,
                                long threshold,
                                long timeout)

  Returns the state of the member. The parameters `threshold` and `timeout` enable the caller to tune this lookup between accuracy and time it will take to complete the call. It is lowest cost to just return the local computed concept for a member's state. `threshold` parameter controls this. If the local state is stale, then the `timeout` parameter enables one to control how long they are willing to wait for more accurate state information from the member itself.

  Parameters:
    `member` - the group member
    `threshold` - allows caller to specify how up-to-date the member state information has to be. The larger this value, the better chance that this method just returns the local concept of this member's state. The smaller this value, the better chance that the local state is not fresh enough and the method will find out directly from the instance what its current state is.
    `timeout` - is the time for which the caller instance should wait to get the state from the concerned member via a network call. if timeout and threshold are both 0, then the default values are used if threshold is 0, then a network call is made to get the state of the member if timeout is 0, then the caller instance checks for the state of the member stored with it within the given threshold
  Returns:
    the state of the member Returns UNKNOWN when the local state for the member is considered stale (determined by threshold value) and the network invocation to get the member state times out before getting a reply from the member of what its state is.

### getAllCurrentMembers

    List<String> getAllCurrentMembers()

  returns a List of strings containing the current group membership including spectator members.

  Returns:
    List

### getCurrentCoreMembersWithStartTimes

    List<String> getCurrentCoreMembersWithStartTimes()

  returns a List of strings containing the current core members in the group. Each entry contains a "::" delimiter after the member token id. After the delimited is a string representation of the long value that stands for that member's startup timestamp.

  Returns:
    List

### getAllCurrentMembersWithStartTimes

    List<String> getAllCurrentMembersWithStartTimes()

  returns a List of strings containing the current group membership including spectator members. Each entry contains a "::" delimiter after the member token id. After the delimited is a string representation of the long value that stands for that member's startup timestamp.

  Returns:
    List

### raiseFence

    void raiseFence(String componentName,
                    String failedMemberToken)
                    throws GMSException

  Enables the caller to raise a logical fence on a specified target member token's component.

  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

  Direct calls to this method is meant only for self-recovering clients. For clients that perform recovery as a surrogate for a failed instance, the FailureRecoverySignal's acquire() method should be called. That method has the effect of raising the fence and performing any other state management operation that may be added in future.

  Parameters:
    `componentName` - the component channel name
    `failedMemberToken` - the failed member
  Throws:
    `GMSException` - if an error occurs

### lowerFence

    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.

  Direct calls to this method is meant only for self-recovering clients. For clients that perform recovery as a surrogate for a failed instance, the FailureRecoverySignal's release() method should be called. That method has the effect of lowering the fence and performing any other state management operation that may be added in future.

  Parameters:
    `componentName` - the component channel name
    `failedMemberToken` - the failed member
  Throws:
    `GMSException` - if an error occurs

### isFenced

    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.

  Parameters:
    `componentName` - the component channel name
    `memberToken` - the member
  Returns:
    boolean

### isMemberAlive

    boolean isMemberAlive(String memberToken)

  Checks if a member is alive

  Parameters:
    `memberToken` - the member
  Returns:
    boolean

### getGroupLeader

    String getGroupLeader()

  Return the leader of the group

  Returns:
    String representing the member identity token of the group leader

### isGroupLeader

    boolean isGroupLeader()

  This is a check to find out if this peer is a group leader.

  Returns:
    true if this peer is the group leader

### announceWatchdogObservedFailure

    void announceWatchdogObservedFailure(String serverToken)
                                         throws GMSException

  GMS WATCHDOG member reports `serverToken` has been observed to have failed to this GMS group.

  This is merely a hint and the GMS system validates that the GMS member has truely failed using the same verification algorithm used when GMS heartbeat reports a member is INDOUBT and SUSPECTED of failure.

  Allows for enhanced GMS failure detection by external control entities (one example is NodeAgent of Glassfish Application Server.) Only a GMS MemberType of WATCHDOG is allowed to broadcast to all members of a group that this `serverToken` has likely failed.

  Parameters:
    `serverToken` - failed member
  Throws:
    `GMSException` - if called by a member that is not a WATCHDOG member or if serverToken is not currently running in group.

### getCurrentView

    List<GMSMember> getCurrentView()

  Return a snapshot of members in current view.

  Note: returns an empty list if no current view.

  Returns:
    current members

### getPreviousView

    List<GMSMember> getPreviousView()

  Return snapshot of members in previous view.

  Note: returns an empty list if no previous view.

  Returns:
    members from previous view

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003 Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.