Class CloudMembershipService

  • All Implemented Interfaces:
    CloudMembershipServiceMBean, MembershipListener, MembershipService

    public class CloudMembershipService
    extends MembershipServiceBase
    implements CloudMembershipServiceMBean
    A MembershipService that uses Kubernetes API(default) or DNS to retrieve the members of a cluster.

    The default implementation of the MembershipProvider component is the KubernetesMembershipProvider. The MembershipProvider can be configured by the membershipProviderClassName property. Possible shortcuts are kubernetes and dns. For dns look at the DNSMembershipProvider.

    Configuration example

    server.xml
     
     <Server ...
    
       <Service ...
    
         <Engine ...
    
           <Host ...
    
             <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster">
               <Channel className="org.apache.catalina.tribes.group.GroupChannel">
                 <Membership className="org.apache.catalina.tribes.membership.cloud.CloudMembershipService"/>
               </Channel>
             </Cluster>
             ...
      
      
    • Field Detail

      • MEMBERSHIP_PROVIDER_CLASS_NAME

        public static final java.lang.String MEMBERSHIP_PROVIDER_CLASS_NAME
        See Also:
        Constant Field Values
      • INITIAL_ID

        protected static final byte[] INITIAL_ID
    • Constructor Detail

      • CloudMembershipService

        public CloudMembershipService()
    • Method Detail

      • getProperty

        public java.lang.Object getProperty​(java.lang.String name)
        Return a property.
        Parameters:
        name - the property name
        Returns:
        the property value
      • setProperty

        public boolean setProperty​(java.lang.String name,
                                   java.lang.String value)
        Set a property.
        Parameters:
        name - the property name
        value - the property value
        Returns:
        true if the property was successfully set
      • getMembershipProviderClassName

        public java.lang.String getMembershipProviderClassName()
        Return the membership provider class.
        Returns:
        the classname
      • setMembershipProviderClassName

        public void setMembershipProviderClassName​(java.lang.String membershipProviderClassName)
        Set the membership provider class.
        Parameters:
        membershipProviderClassName - the class name
      • start

        public void start​(int level)
                   throws java.lang.Exception
        Description copied from interface: MembershipService
        Starts the membership service. If a membership listeners is added the listener will start to receive membership events.
        Specified by:
        start in interface MembershipService
        Parameters:
        level - - level MBR_RX starts listening for members, level MBR_TX starts broad casting the server
        Throws:
        java.lang.Exception - if the service fails to start.
        java.lang.IllegalArgumentException - if the level is incorrect.
      • stop

        public void stop​(int level)
        Description copied from interface: MembershipService
        Starts the membership service. If a membership listeners is added the listener will start to receive membership events.
        Specified by:
        stop in interface MembershipService
        Parameters:
        level - - level MBR_RX stops listening for members, level MBR_TX stops broad casting the server
      • getLocalMember

        public Member getLocalMember​(boolean incAliveTime)
        Description copied from interface: MembershipService
        Get the local member.
        Specified by:
        getLocalMember in interface MembershipService
        Parameters:
        incAliveTime - true to set the alive time on the local member
        Returns:
        the member object that defines this member
      • setLocalMemberProperties

        public void setLocalMemberProperties​(java.lang.String listenHost,
                                             int listenPort,
                                             int securePort,
                                             int udpPort)
        Description copied from interface: MembershipService
        Sets the local member properties for broadcasting.
        Specified by:
        setLocalMemberProperties in interface MembershipService
        Parameters:
        listenHost - Listen to host
        listenPort - Listen to port
        securePort - Use a secure port
        udpPort - Use UDP
      • setPayload

        public void setPayload​(byte[] payload)
        Description copied from interface: MembershipService
        Set a payload to be broadcasted with each membership broadcast.
        Specified by:
        setPayload in interface MembershipService
        Parameters:
        payload - byte[]
      • setMembershipProvider

        public void setMembershipProvider​(MembershipProvider memberProvider)
      • setConnectTimeout

        public void setConnectTimeout​(int connectTimeout)
      • setReadTimeout

        public void setReadTimeout​(int readTimeout)
      • setExpirationTime

        public void setExpirationTime​(long expirationTime)