Class AbstractDomainManager

    • Constructor Detail

      • AbstractDomainManager

        protected AbstractDomainManager​(String domain)
        Constructor.
        Parameters:
        domain - the domain to manage
    • Method Detail

      • getRoleChangeHandlers

        public final Map<String,​RoleChangeHandler> getRoleChangeHandlers()
        Check the current view of the registered change handlers.
        Returns:
        an immutable copy of the currently registered change handlers
      • becomeActive

        protected final void becomeActive()
        Executed when becoming ACTIVE for the managed domain. This blocks until all registrants have processed the becomeActive() in their handler.
      • becomeStandby

        protected final void becomeStandby()
        Executed when becoming STANDBY for the managed domain. This blocks until all registrants have processed the becomeStandby() in their handler.
      • getCurrentRole

        protected final Role getCurrentRole()
      • getDomain

        protected final String getDomain()
      • onFirstRegister

        protected abstract void onFirstRegister()
        Implementations must handle any specific logic for dealing with a registration that adds to the map of handlers for the first time (such as connecting).
      • onLastDeregister

        protected abstract void onLastDeregister()
        Implementations must handle any specific logic for dealing with a deregistration that empties the map of handlers (such as disconnecting).
      • register

        public final void register​(String id,
                                   RoleChangeHandler roleChangeHandler)
        Description copied from interface: DomainManager
        Register with the domain being managed. This is a non-blocking call.

        Ids must be unique to this manager. Attempting to register the same Id twice will result in an exception.

        The methods specified by the RoleChangeHandler passed to this method must not block.

        Specified by:
        register in interface DomainManager
        Parameters:
        id - the Id to register
        roleChangeHandler - the role change handler to register
      • deregister

        public final void deregister​(String id)
        Description copied from interface: DomainManager
        Deregister with the domain being managed. This is a non-blocking call.
        Specified by:
        deregister in interface DomainManager
        Parameters:
        id - the Id to register
      • isRegistered

        public final boolean isRegistered​(String id)
        Description copied from interface: DomainManager
        Checks if a given Id is registered.
        Specified by:
        isRegistered in interface DomainManager
        Parameters:
        id - the Id to check
        Returns:
        true if registered, false otherwise
      • isAnythingRegistered

        public final boolean isAnythingRegistered()
        Description copied from interface: DomainManager
        Checks if anything is currently registered with the domain being managed.
        Specified by:
        isAnythingRegistered in interface DomainManager
        Returns:
        true if one or more registrants are currently registered, false otherwise