Class GroupManagementServiceImpl

  • All Implemented Interfaces:
    com.sun.enterprise.ee.cms.core.GroupManagementService, java.lang.Runnable

    public class GroupManagementServiceImpl
    extends java.lang.Object
    implements com.sun.enterprise.ee.cms.core.GroupManagementService, java.lang.Runnable
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.sun.enterprise.ee.cms.core.GroupManagementService

        com.sun.enterprise.ee.cms.core.GroupManagementService.MemberType, com.sun.enterprise.ee.cms.core.GroupManagementService.RECOVERY_STATE
    • Constructor Summary

      Constructors 
      Constructor Description
      GroupManagementServiceImpl()  
      GroupManagementServiceImpl​(java.lang.String serverToken, java.lang.String groupName, com.sun.enterprise.ee.cms.core.GroupManagementService.MemberType membertype, java.util.Properties properties)
      Creates a GMSContext instance with the given paramters.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addActionFactory​(com.sun.enterprise.ee.cms.core.FailureNotificationActionFactory failureNotificationActionFactory)
      Registers a FailureNotificationActionFactory instance.
      void addActionFactory​(com.sun.enterprise.ee.cms.core.FailureSuspectedActionFactory failureSuspectedActionFactory)  
      void addActionFactory​(com.sun.enterprise.ee.cms.core.GroupLeadershipNotificationActionFactory groupLeadershipNotificationActionFactory)  
      void addActionFactory​(com.sun.enterprise.ee.cms.core.JoinedAndReadyNotificationActionFactory joinedAndReadyNotificationActionFactory)
      Registers a JoinedAndReadyNotificationActionFactory instance.
      void addActionFactory​(com.sun.enterprise.ee.cms.core.JoinNotificationActionFactory joinNotificationActionFactory)
      Registers a JoinNotificationActionFactory instance.
      void addActionFactory​(com.sun.enterprise.ee.cms.core.MessageActionFactory messageActionFactory, java.lang.String componentName)
      Registers a MessageActionFactory instance for the specified component name.
      void addActionFactory​(com.sun.enterprise.ee.cms.core.PlannedShutdownActionFactory plannedShutdownActionFactory)
      Registers a PlannedShuttdownActionFactory instance.
      void addActionFactory​(java.lang.String componentName, com.sun.enterprise.ee.cms.core.FailureRecoveryActionFactory failureRecoveryActionFactory)
      Registers a FailureRecoveryActionFactory instance.
      void announceGroupShutdown​(java.lang.String groupName, com.sun.enterprise.ee.cms.core.GMSConstants.shutdownState shutdownState)
      This method is used to announce that the group is about to be shutdown.
      void announceGroupStartup​(java.lang.String groupName, com.sun.enterprise.ee.cms.core.GMSConstants.groupStartupState startupState, java.util.List<java.lang.String> memberTokens)  
      void announceWatchdogObservedFailure​(java.lang.String serverToken)  
      java.util.Map<java.io.Serializable,​java.io.Serializable> getAllMemberDetails​(java.io.Serializable key)  
      com.sun.enterprise.ee.cms.core.GroupHandle getGroupHandle()
      Returns an implementation of GroupHandle
      java.lang.String getGroupName()  
      java.lang.String getInstanceName()  
      java.util.Map<java.io.Serializable,​java.io.Serializable> getMemberDetails​(java.lang.String memberToken)
      returns the details pertaining to the given member.
      com.sun.enterprise.ee.cms.core.GroupManagementService.MemberType getMemberType()  
      void initialize​(java.lang.String serverToken, java.lang.String groupName, com.sun.enterprise.ee.cms.core.GroupManagementService.MemberType membertype, java.util.Properties properties)  
      boolean isGroupBeingShutdown()  
      boolean isGroupBeingShutdown​(java.lang.String groupName)
      Deprecated. 
      void join()  
      int outstandingNotifications()  
      void removeActionFactory​(com.sun.enterprise.ee.cms.core.FailureNotificationActionFactory failureNotificationActionFactory)
      Removes a FailureNotificationActionFactory instance To remove a MessageActionFactory for a specific component, use the method: removeActionFactory(String componentName);
      void removeActionFactory​(com.sun.enterprise.ee.cms.core.GroupLeadershipNotificationActionFactory groupLeadershipNotificationActionFactory)  
      void removeActionFactory​(com.sun.enterprise.ee.cms.core.JoinedAndReadyNotificationActionFactory joinedAndReadyNotificationActionFactory)
      Removes a JoinedAndReadyNotificationActionFactory instance To remove a MessageActionFactory for a specific component, use the method: removeActionFactory(String componentName);
      void removeActionFactory​(com.sun.enterprise.ee.cms.core.JoinNotificationActionFactory joinNotificationActionFactory)
      Removes a JoinNotificationActionFactory instance To remove a MessageActionFactory for a specific component, use the method: removeActionFactory(String componentName);
      void removeActionFactory​(com.sun.enterprise.ee.cms.core.PlannedShutdownActionFactory plannedShutdownActionFactory)
      Removes a PlannedShutdownActionFactory instance To remove a MessageActionFactory for a specific component, use the method: removeActionFactory(String componentName);
      void removeFailureRecoveryActionFactory​(java.lang.String componentName)
      Removes a FailureRecoveryActionFactory instance To remove a MessageActionFactory for a specific component, use the method: removeActionFactory(String componentName);
      void removeFailureSuspectedActionFactory​(com.sun.enterprise.ee.cms.core.FailureSuspectedActionFactory failureSuspectedActionFactory)  
      void removeMessageActionFactory​(java.lang.String componentName)
      Removes a MessageActionFactory instance belonging to the specified component
      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 reportJoinedAndReadyState​(java.lang.String groupName)
      Deprecated.
      use reportJoinedAndReadyState()
      void run()  
      void setMemberDetails​(java.lang.String serverToken, java.util.Map<? extends java.lang.Object,​? extends java.lang.Object> keyValuePairs)
      for this serverToken, use the map to derive key value pairs that constitute data pertaining to this member's details
      void shutdown​(com.sun.enterprise.ee.cms.core.GMSConstants.shutdownType shutdownType)
      Sends a shutdown command to the GMS indicating that the parent thread is about to be shutdown as part of a planned shutdown operation
      void updateMemberDetails​(java.lang.String memberToken, java.io.Serializable key, java.io.Serializable value)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GroupManagementServiceImpl

        public GroupManagementServiceImpl​(java.lang.String serverToken,
                                          java.lang.String groupName,
                                          com.sun.enterprise.ee.cms.core.GroupManagementService.MemberType membertype,
                                          java.util.Properties properties)
        Creates a GMSContext instance with the given paramters. GMSContext calls the underlying Group Communication Provider to initialize it with these parameters.
        Parameters:
        serverToken - identity token of this member process
        groupName - name of the group
        membertype - Type of member as specified in GroupManagementService.MemberType
        properties - Configuration Properties
      • GroupManagementServiceImpl

        public GroupManagementServiceImpl()
    • Method Detail

      • initialize

        public void initialize​(java.lang.String serverToken,
                               java.lang.String groupName,
                               com.sun.enterprise.ee.cms.core.GroupManagementService.MemberType membertype,
                               java.util.Properties properties)
        Specified by:
        initialize in interface com.sun.enterprise.ee.cms.core.GroupManagementService
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • addActionFactory

        public void addActionFactory​(com.sun.enterprise.ee.cms.core.FailureNotificationActionFactory failureNotificationActionFactory)
        Registers a FailureNotificationActionFactory instance. To add MessageActionFactory instance, use the method addActionFactory(MessageActionFactory maf, String componentName);
        Specified by:
        addActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        failureNotificationActionFactory - implementation of this interface
      • addActionFactory

        public void addActionFactory​(java.lang.String componentName,
                                     com.sun.enterprise.ee.cms.core.FailureRecoveryActionFactory failureRecoveryActionFactory)
        Registers a FailureRecoveryActionFactory instance. To add MessageActionFactory instance, use the method addActionFactory(MessageActionFactory maf, String componentName);
        Specified by:
        addActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        componentName - name of component
        failureRecoveryActionFactory - implmentation of this interface
      • addActionFactory

        public void addActionFactory​(com.sun.enterprise.ee.cms.core.JoinedAndReadyNotificationActionFactory joinedAndReadyNotificationActionFactory)
        Registers a JoinedAndReadyNotificationActionFactory instance.
        Specified by:
        addActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        joinedAndReadyNotificationActionFactory - Implementation of this interface produces a JoinedAndReadyNotificationAction instance which consumes the member joined and ready notification signal.
      • addActionFactory

        public void addActionFactory​(com.sun.enterprise.ee.cms.core.JoinNotificationActionFactory joinNotificationActionFactory)
        Registers a JoinNotificationActionFactory instance.
        Specified by:
        addActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        joinNotificationActionFactory - implementation of this interface
      • addActionFactory

        public void addActionFactory​(com.sun.enterprise.ee.cms.core.PlannedShutdownActionFactory plannedShutdownActionFactory)
        Registers a PlannedShuttdownActionFactory instance. To add MessageActionFactory instance, use the method addActionFactory(MessageActionFactory maf, String componentName);
        Specified by:
        addActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        plannedShutdownActionFactory - implementation of this interface
      • addActionFactory

        public void addActionFactory​(com.sun.enterprise.ee.cms.core.MessageActionFactory messageActionFactory,
                                     java.lang.String componentName)
        Registers a MessageActionFactory instance for the specified component name.
        Specified by:
        addActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        messageActionFactory - implementation of this interface
        componentName - name of component to identify target component for message delivery
      • addActionFactory

        public void addActionFactory​(com.sun.enterprise.ee.cms.core.FailureSuspectedActionFactory failureSuspectedActionFactory)
        Specified by:
        addActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
      • addActionFactory

        public void addActionFactory​(com.sun.enterprise.ee.cms.core.GroupLeadershipNotificationActionFactory groupLeadershipNotificationActionFactory)
        Specified by:
        addActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
      • removeActionFactory

        public void removeActionFactory​(com.sun.enterprise.ee.cms.core.FailureNotificationActionFactory failureNotificationActionFactory)
        Removes a FailureNotificationActionFactory instance To remove a MessageActionFactory for a specific component, use the method: removeActionFactory(String componentName);
        Specified by:
        removeActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        failureNotificationActionFactory - implementation of this interface
      • removeFailureRecoveryActionFactory

        public void removeFailureRecoveryActionFactory​(java.lang.String componentName)
        Removes a FailureRecoveryActionFactory instance To remove a MessageActionFactory for a specific component, use the method: removeActionFactory(String componentName);
        Specified by:
        removeFailureRecoveryActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        componentName - name of component
      • removeFailureSuspectedActionFactory

        public void removeFailureSuspectedActionFactory​(com.sun.enterprise.ee.cms.core.FailureSuspectedActionFactory failureSuspectedActionFactory)
        Specified by:
        removeFailureSuspectedActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
      • removeActionFactory

        public void removeActionFactory​(com.sun.enterprise.ee.cms.core.JoinNotificationActionFactory joinNotificationActionFactory)
        Removes a JoinNotificationActionFactory instance To remove a MessageActionFactory for a specific component, use the method: removeActionFactory(String componentName);
        Specified by:
        removeActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        joinNotificationActionFactory - implementation of this interface
      • removeActionFactory

        public void removeActionFactory​(com.sun.enterprise.ee.cms.core.JoinedAndReadyNotificationActionFactory joinedAndReadyNotificationActionFactory)
        Removes a JoinedAndReadyNotificationActionFactory instance To remove a MessageActionFactory for a specific component, use the method: removeActionFactory(String componentName);
        Specified by:
        removeActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        joinedAndReadyNotificationActionFactory - implementation of this interface
      • removeActionFactory

        public void removeActionFactory​(com.sun.enterprise.ee.cms.core.PlannedShutdownActionFactory plannedShutdownActionFactory)
        Removes a PlannedShutdownActionFactory instance To remove a MessageActionFactory for a specific component, use the method: removeActionFactory(String componentName);
        Specified by:
        removeActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        plannedShutdownActionFactory - implementation of this interface
      • removeMessageActionFactory

        public void removeMessageActionFactory​(java.lang.String componentName)
        Removes a MessageActionFactory instance belonging to the specified component
        Specified by:
        removeMessageActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        componentName - name of component
      • removeActionFactory

        public void removeActionFactory​(com.sun.enterprise.ee.cms.core.GroupLeadershipNotificationActionFactory groupLeadershipNotificationActionFactory)
        Specified by:
        removeActionFactory in interface com.sun.enterprise.ee.cms.core.GroupManagementService
      • getGroupHandle

        public com.sun.enterprise.ee.cms.core.GroupHandle getGroupHandle()
        Returns an implementation of GroupHandle
        Specified by:
        getGroupHandle in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Returns:
        com.sun.enterprise.ee.cms.GroupHandle
      • shutdown

        public void shutdown​(com.sun.enterprise.ee.cms.core.GMSConstants.shutdownType shutdownType)
        Sends a shutdown command to the GMS indicating that the parent thread is about to be shutdown as part of a planned shutdown operation
        Specified by:
        shutdown in interface com.sun.enterprise.ee.cms.core.GroupManagementService
      • updateMemberDetails

        public void updateMemberDetails​(java.lang.String memberToken,
                                        java.io.Serializable key,
                                        java.io.Serializable value)
                                 throws com.sun.enterprise.ee.cms.core.GMSException
        Specified by:
        updateMemberDetails in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Throws:
        com.sun.enterprise.ee.cms.core.GMSException
      • getMemberDetails

        public java.util.Map<java.io.Serializable,​java.io.Serializable> getMemberDetails​(java.lang.String memberToken)
        returns the details pertaining to the given member. At times, details pertaining to all members may be stored in the Cache but keyed by the given member token. Through this route, details of all members could be obtained. returns a Map containing key-value pairs constituting data pertaining to the member's details
        Specified by:
        getMemberDetails in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        memberToken - identity token of the member process
        Returns:
        Map <Serializable, Serializable>
      • getAllMemberDetails

        public java.util.Map<java.io.Serializable,​java.io.Serializable> getAllMemberDetails​(java.io.Serializable key)
        Specified by:
        getAllMemberDetails in interface com.sun.enterprise.ee.cms.core.GroupManagementService
      • getGroupName

        public java.lang.String getGroupName()
        Specified by:
        getGroupName in interface com.sun.enterprise.ee.cms.core.GroupManagementService
      • getMemberType

        public com.sun.enterprise.ee.cms.core.GroupManagementService.MemberType getMemberType()
        Specified by:
        getMemberType in interface com.sun.enterprise.ee.cms.core.GroupManagementService
      • getInstanceName

        public java.lang.String getInstanceName()
        Specified by:
        getInstanceName in interface com.sun.enterprise.ee.cms.core.GroupManagementService
      • setMemberDetails

        public void setMemberDetails​(java.lang.String serverToken,
                                     java.util.Map<? extends java.lang.Object,​? extends java.lang.Object> keyValuePairs)
                              throws com.sun.enterprise.ee.cms.core.GMSException
        for this serverToken, use the map to derive key value pairs that constitute data pertaining to this member's details
        Parameters:
        serverToken - - member token id for this member.
        keyValuePairs - - a Map containing key-value pairs
        Throws:
        com.sun.enterprise.ee.cms.core.GMSException - wraps underlying exception that caused adding of member details to fail.
      • join

        public void join()
                  throws com.sun.enterprise.ee.cms.core.GMSException
        Specified by:
        join in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Throws:
        com.sun.enterprise.ee.cms.core.GMSException
      • announceGroupShutdown

        public void announceGroupShutdown​(java.lang.String groupName,
                                          com.sun.enterprise.ee.cms.core.GMSConstants.shutdownState shutdownState)
        This method is used to announce that the group is about to be shutdown.
        Specified by:
        announceGroupShutdown in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        groupName - name of group being shutdown.
      • announceGroupStartup

        public void announceGroupStartup​(java.lang.String groupName,
                                         com.sun.enterprise.ee.cms.core.GMSConstants.groupStartupState startupState,
                                         java.util.List<java.lang.String> memberTokens)
        Specified by:
        announceGroupStartup in interface com.sun.enterprise.ee.cms.core.GroupManagementService
      • reportJoinedAndReadyState

        public void reportJoinedAndReadyState​(java.lang.String groupName)
        Deprecated.
        use reportJoinedAndReadyState()

        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.

        This api should be called only after group join operation has completed.

        Specified by:
        reportJoinedAndReadyState in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        groupName - name of the group
      • reportJoinedAndReadyState

        public 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. 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.

        This api should be called only after group join operation has completed.

        Specified by:
        reportJoinedAndReadyState in interface com.sun.enterprise.ee.cms.core.GroupManagementService
      • isGroupBeingShutdown

        public boolean isGroupBeingShutdown​(java.lang.String groupName)
        Deprecated.

        This API allows applications to query GMS to see if the group is shutting down. This helps with any pre-shutdown processing that may be required to be done on the application's side.

        Also returns true when called after the gms context has left the group during a group shutdown.

        Specified by:
        isGroupBeingShutdown in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Parameters:
        groupName - the group name
        Returns:
        boolean
      • isGroupBeingShutdown

        public boolean isGroupBeingShutdown()
        Specified by:
        isGroupBeingShutdown in interface com.sun.enterprise.ee.cms.core.GroupManagementService
      • announceWatchdogObservedFailure

        public void announceWatchdogObservedFailure​(java.lang.String serverToken)
                                             throws com.sun.enterprise.ee.cms.core.GMSException
        Specified by:
        announceWatchdogObservedFailure in interface com.sun.enterprise.ee.cms.core.GroupManagementService
        Throws:
        com.sun.enterprise.ee.cms.core.GMSException
      • outstandingNotifications

        public int outstandingNotifications()