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.impl.jxta
Class GroupCommunicationProviderImpl

    java.lang.Object
      com.sun.enterprise.ee.cms.impl.jxta.GroupCommunicationProviderImpl

All Implemented Interfaces:
  GroupCommunicationProvider, com.sun.enterprise.jxtamgmt.ClusterMessageListener, com.sun.enterprise.jxtamgmt.ClusterViewEventListener, EventListener

    public class GroupCommunicationProviderImpl

extends Object
implements GroupCommunicationProvider, com.sun.enterprise.jxtamgmt.ClusterViewEventListener, com.sun.enterprise.jxtamgmt.ClusterMessageListener

Implements the GroupCommunicationProvider interface to plug in JxtaClusterManagement layer as a Group Communication Provider for GMS.

Version:
  $Revision: 1.35 $
Author:
  Shreedhar Ganapathy Date: Jun 26, 2006

Constructor Summary
`GroupCommunicationProviderImpl(String groupName)`

Method Summary
`void` | `announceClusterShutdown(GMSMessage gmsMessage)` Sends an announcement to the group that a cluster wide shutdown is impending
`void` | `announceGroupStartup(String groupName, GMSConstants.groupStartupState startupState, List<String> memberTokens)` Demarcate the INITIATION and COMPLETION of group startup.
`void` | `announceWatchdogObservedFailure(String serverToken)` Allow 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 failed.
`void` | `assumeGroupLeadership()` Provides for this instance to become a group leader explicitly.
`void` | `clusterViewEvent(com.sun.enterprise.jxtamgmt.ClusterViewEvent clusterViewEvent, com.sun.enterprise.jxtamgmt.ClusterView clusterView)` Called when a cluster view event occurs.
`String` | `getGroupLeader()` Returns the Group Leader as defined by the underlying Group Communication Provider.
`Object` | `getLocalAddress()` Returns the address representing the peer identified by this process.
`List<String>` | `getMembers()` returns a list of members that are currently alive in the group
`MemberStates` | `getMemberState(String memberIdentityToken)` Returns the member state as defined in the Enum MemberStates
`MemberStates` | `getMemberState(String member, long threshold, long timeout)` Returns the state of the member.
`void` | `handleClusterMessage(com.sun.enterprise.jxtamgmt.SystemAdvertisement adv, Object message)` Called when a message is received from another member.
`void` | `initializeGroupCommunicationProvider(String memberName, String groupName, Map<String,String> identityMap, Map configProperties)` Initializes the Group Communication Service Provider with the requisite values of group identity, member(self) identity, and a Map containing recognized and valid configuration properties that can be set/overriden by the employing application.
`boolean` | `isDiscoveryInProgress()`
`boolean` | `isGroupLeader()` Returns true if this peer is the leader of the group
`void` | `join()` Joins the group using semantics specified by the underlying GCP system
`void` | `leave(boolean isClusterShutdown)` Leaves the group as a result of a planned administrative action to shutdown.
`void` | `reportJoinedAndReadyState()` This API is provided for the parent application to report to the group its joined and ready state to begin processing its operations.
`void` | `sendMessage(Serializable message)` Sends a message to the entire group using the underlying group communication provider's APIs.
`void` | `sendMessage(String targetMemberIdentityToken, Serializable message, boolean synchronous)` Sends a message using the underlying group communication providers'(GCP's) APIs.
`void` | `setGroupStoppingState()` Can be used especially to inform the HealthMonitoring service that the group is shutting down.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GroupCommunicationProviderImpl

    public GroupCommunicationProviderImpl(String groupName)

Method Detail

### clusterViewEvent

    public void clusterViewEvent(com.sun.enterprise.jxtamgmt.ClusterViewEvent clusterViewEvent,
                                 com.sun.enterprise.jxtamgmt.ClusterView clusterView)

  Description copied from interface: `com.sun.enterprise.jxtamgmt.ClusterViewEventListener`
  Called when a cluster view event occurs.

  Specified by:
    `clusterViewEvent` in interface `com.sun.enterprise.jxtamgmt.ClusterViewEventListener`
  Parameters:
    `clusterViewEvent` - The event that occurred.
    `clusterView` - the current membership snapshot after the event.

### initializeGroupCommunicationProvider

    public void initializeGroupCommunicationProvider(String memberName,
                                                     String groupName,
                                                     Map<String,String> identityMap,
                                                     Map configProperties)

  Initializes the Group Communication Service Provider with the requisite values of group identity, member(self) identity, and a Map containing recognized and valid configuration properties that can be set/overriden by the employing application. The valid property keys must be specified in a datastructure that is available to the implementation and to GMS.

  Specified by:
    `initializeGroupCommunicationProvider` in interface `GroupCommunicationProvider`
  Parameters:
    `memberName` - member name
    `groupName` - group name
    `identityMap` - valid configuration properties
    `configProperties` - configuration properties

### join

    public void join()

  Joins the group using semantics specified by the underlying GCP system

  Specified by:
    `join` in interface `GroupCommunicationProvider`

### announceClusterShutdown

    public void announceClusterShutdown(GMSMessage gmsMessage)

  Description copied from interface: `GroupCommunicationProvider`
  Sends an announcement to the group that a cluster wide shutdown is impending

  Specified by:
    `announceClusterShutdown` in interface `GroupCommunicationProvider`
  Parameters:
    `gmsMessage` - an object that encapsulates the application's Message

### announceGroupStartup

    public void announceGroupStartup(String groupName,
                                     GMSConstants.groupStartupState startupState,
                                     List<String> memberTokens)

  Demarcate the INITIATION and COMPLETION of group startup. Only useful for an administration utility that statically knows of all members in group and starts them at same time. This API allows for an optimization by GMS clients to know whether GMS Join and JoinedAndReady events are happening as part of group startup or individual instance startups.

  Specified by:
    `announceGroupStartup` in interface `GroupCommunicationProvider`
  Parameters:
    `groupName` - name of group
    `startupState` - INITATED, COMPLETED_SUCCESS or COMPLETED_FAILED
    `memberTokens` - static list of members associated with startupState. Failed members if state is COMPLETED_FAILED>

### leave

    public void leave(boolean isClusterShutdown)

  Leaves the group as a result of a planned administrative action to shutdown.

  Specified by:
    `leave` in interface `GroupCommunicationProvider`
  Parameters:
    `isClusterShutdown` - - true if we are leaving as part of a cluster wide shutdown

### sendMessage

    public void sendMessage(String targetMemberIdentityToken,
                            Serializable message,
                            boolean synchronous)
                     throws GMSException,
                            MemberNotInViewException

  Sends a message using the underlying group communication providers'(GCP's) APIs. Requires the users' message to be wrapped into a GMSMessage object.

  Specified by:
    `sendMessage` in interface `GroupCommunicationProvider`
  Parameters:
    `targetMemberIdentityToken` - The member token string that identifies the target member to which this message is addressed. The implementation is expected to provide a mapping the member token to the GCP's addressing semantics. If null, the entire group would receive this message.
    `message` - a Serializable object that wraps the user specified message in order to allow remote GMS instances to unpack this message appropriately.
    `synchronous` - setting true here will call the underlying GCP's api that corresponds to a synchronous message, if available.
  Throws:
    `GMSException`
    `MemberNotInViewException`

### sendMessage

    public void sendMessage(Serializable message)
                     throws GMSException,
                            MemberNotInViewException

  Description copied from interface: `GroupCommunicationProvider`
  Sends a message to the entire group using the underlying group communication provider's APIs. The Serializable object here is a GMSMessage Object.

  Specified by:
    `sendMessage` in interface `GroupCommunicationProvider`
  Parameters:
    `message` - a Serializable object that wraps the users specified message in order to allow remote GMS instances to unpack this message appropriately
  Throws:
    `GMSException` - Underlying exception is wrapped in a GMSException
    `MemberNotInViewException`

### getLocalAddress

    public Object getLocalAddress()

  Returns the address representing the peer identified by this process. The address object is of the type corresponding to the underlying GCP. In this case, the jxta ID of this peer is returned.

  Returns:
    Object - representing this peer's address.

### getMembers

    public List<String> getMembers()

  returns a list of members that are currently alive in the group

  Specified by:
    `getMembers` in interface `GroupCommunicationProvider`
  Returns:
    list of current live members

### isGroupLeader

    public boolean isGroupLeader()

  Description copied from interface: `GroupCommunicationProvider`
  Returns true if this peer is the leader of the group

  Specified by:
    `isGroupLeader` in interface `GroupCommunicationProvider`
  Returns:
    boolean true if group leader, false if not.

### getMemberState

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

  Description copied from interface: `GroupCommunicationProvider`
  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.

  Specified by:
    `getMemberState` in interface `GroupCommunicationProvider`
    `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.

### getMemberState

    public MemberStates getMemberState(String memberIdentityToken)

  Description copied from interface: `GroupCommunicationProvider`
  Returns the member state as defined in the Enum MemberStates

  Specified by:
    `getMemberState` in interface `GroupCommunicationProvider`
  Parameters:
    `memberIdentityToken` - identity of member.
  Returns:
    MemberStates

### getGroupLeader

    public String getGroupLeader()

  Description copied from interface: `GroupCommunicationProvider`
  Returns the Group Leader as defined by the underlying Group Communication Provider.

  Specified by:
    `getGroupLeader` in interface `GroupCommunicationProvider`
  Returns:
    String

### handleClusterMessage

    public void handleClusterMessage(com.sun.enterprise.jxtamgmt.SystemAdvertisement adv,
                                     Object message)

  Description copied from interface: `com.sun.enterprise.jxtamgmt.ClusterMessageListener`
  Called when a message is received from another member.

  Specified by:
    `handleClusterMessage` in interface `com.sun.enterprise.jxtamgmt.ClusterMessageListener`
  Parameters:
    `adv` - source system advertisement
    `message` - the message

### assumeGroupLeadership

    public void assumeGroupLeadership()

  Description copied from interface: `GroupCommunicationProvider`

  Provides for this instance to become a group leader explicitly. Typically this can be employed by an administrative member to become a group leader prior to shutting down a group of members simultaneously.

  For underlying Group Communication Providers who don't support the feature of a explicit leader role assumption, the implementation of this method would be a no-op.

  Specified by:
    `assumeGroupLeadership` in interface `GroupCommunicationProvider`

### setGroupStoppingState

    public void setGroupStoppingState()

  Description copied from interface: `GroupCommunicationProvider`
  Can be used especially to inform the HealthMonitoring service that the group is shutting down.

  Specified by:
    `setGroupStoppingState` in interface `GroupCommunicationProvider`

### reportJoinedAndReadyState

    public void reportJoinedAndReadyState()

  Description copied from interface: `GroupCommunicationProvider`
  This API is provided for the parent application to report to the group its joined and ready state to begin processing its operations. The group member that this parent application represents is now ready to process its operations at the time of this announcement to the group. GMS clients in all other group members that are interested in knowing when another member is ready to start processing operations, can subscribe to the event JoinedAndReadyEvent and be notified of this JoinedAndReadyNotificationSignal.

  Specified by:
    `reportJoinedAndReadyState` in interface `GroupCommunicationProvider`

### announceWatchdogObservedFailure

    public void announceWatchdogObservedFailure(String serverToken)
                                         throws GMSException

  Description copied from interface: `GroupCommunicationProvider`
  Allow 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 failed.

  Specified by:
    `announceWatchdogObservedFailure` in interface `GroupCommunicationProvider`
  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.

### isDiscoveryInProgress

    public boolean isDiscoveryInProgress()

  Specified by:
    `isDiscoveryInProgress` in interface `GroupCommunicationProvider`

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.