|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.enterprise.ee.cms.impl.jxta.GroupCommunicationProviderImpl
public class GroupCommunicationProviderImpl
Implements the GroupCommunicationProvider interface to plug in JxtaClusterManagement layer as a Group Communication Provider for GMS.
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 |
---|
public GroupCommunicationProviderImpl(String groupName)
Method Detail |
---|
public void clusterViewEvent(com.sun.enterprise.jxtamgmt.ClusterViewEvent clusterViewEvent, com.sun.enterprise.jxtamgmt.ClusterView clusterView)
com.sun.enterprise.jxtamgmt.ClusterViewEventListener
clusterViewEvent
in interface com.sun.enterprise.jxtamgmt.ClusterViewEventListener
clusterViewEvent
- The event that occurred.clusterView
- the current membership snapshot after the event.public void initializeGroupCommunicationProvider(String memberName, String groupName, Map<String,String> identityMap, Map configProperties)
initializeGroupCommunicationProvider
in interface GroupCommunicationProvider
memberName
- member namegroupName
- group nameidentityMap
- valid configuration propertiesconfigProperties
- configuration propertiespublic void join()
join
in interface GroupCommunicationProvider
public void announceClusterShutdown(GMSMessage gmsMessage)
GroupCommunicationProvider
announceClusterShutdown
in interface GroupCommunicationProvider
gmsMessage
- an object that encapsulates the application's Messagepublic void announceGroupStartup(String groupName, GMSConstants.groupStartupState startupState, List<String> memberTokens)
announceGroupStartup
in interface GroupCommunicationProvider
groupName
- name of groupstartupState
- INITATED, COMPLETED_SUCCESS or COMPLETED_FAILEDmemberTokens
- static list of members associated with startupState. Failed members if state is COMPLETED_FAILED>public void leave(boolean isClusterShutdown)
leave
in interface GroupCommunicationProvider
isClusterShutdown
- - true if we are leaving as part of a cluster wide shutdownpublic void sendMessage(String targetMemberIdentityToken, Serializable message, boolean synchronous) throws GMSException, MemberNotInViewException
sendMessage
in interface GroupCommunicationProvider
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.
GMSException
MemberNotInViewException
public void sendMessage(Serializable message) throws GMSException, MemberNotInViewException
GroupCommunicationProvider
sendMessage
in interface GroupCommunicationProvider
message
- a Serializable object that wraps the users specified
message in order to allow remote GMS instances to unpack this message
appropriately
GMSException
- Underlying exception is wrapped in a GMSException
MemberNotInViewException
public Object getLocalAddress()
public List<String> getMembers()
getMembers
in interface GroupCommunicationProvider
public boolean isGroupLeader()
GroupCommunicationProvider
isGroupLeader
in interface GroupCommunicationProvider
public MemberStates getMemberState(String member, long threshold, long timeout)
GroupCommunicationProvider
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.
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
public MemberStates getMemberState(String memberIdentityToken)
GroupCommunicationProvider
getMemberState
in interface GroupCommunicationProvider
memberIdentityToken
- identity of member.
public String getGroupLeader()
GroupCommunicationProvider
getGroupLeader
in interface GroupCommunicationProvider
public void handleClusterMessage(com.sun.enterprise.jxtamgmt.SystemAdvertisement adv, Object message)
com.sun.enterprise.jxtamgmt.ClusterMessageListener
handleClusterMessage
in interface com.sun.enterprise.jxtamgmt.ClusterMessageListener
adv
- source system advertisementmessage
- the messagepublic void assumeGroupLeadership()
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.
assumeGroupLeadership
in interface GroupCommunicationProvider
public void setGroupStoppingState()
GroupCommunicationProvider
setGroupStoppingState
in interface GroupCommunicationProvider
public void reportJoinedAndReadyState()
GroupCommunicationProvider
reportJoinedAndReadyState
in interface GroupCommunicationProvider
public void announceWatchdogObservedFailure(String serverToken) throws GMSException
GroupCommunicationProvider
serverToken
has failed.
announceWatchdogObservedFailure
in interface GroupCommunicationProvider
serverToken
- failed member
GMSException
- if called by a member that is not a WATCHDOG member or if serverToken is not currently running in group.public boolean isDiscoveryInProgress()
isDiscoveryInProgress
in interface GroupCommunicationProvider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |