Class CloudMembershipService

java.lang.Object
org.apache.catalina.tribes.membership.MembershipServiceBase
org.apache.catalina.tribes.membership.cloud.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 Details

    • sm

      protected static final StringManager sm
    • MEMBERSHIP_PROVIDER_CLASS_NAME

      public static final String MEMBERSHIP_PROVIDER_CLASS_NAME
      See Also:
    • INITIAL_ID

      protected static final byte[] INITIAL_ID
  • Constructor Details

    • CloudMembershipService

      public CloudMembershipService()
  • Method Details

    • getProperty

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

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

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

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

      public void start(int level) throws 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:
      Exception - if the service fails to start.
    • stop

      public void stop(int level)
      Description copied from interface: MembershipService
      Stops 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(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[]
    • setDomain

      public void setDomain(byte[] domain)
      Description copied from interface: MembershipService
      Set the associated domain.
      Specified by:
      setDomain in interface MembershipService
      Parameters:
      domain - the domain
    • getMembershipProvider

      public MembershipProvider getMembershipProvider()
      Description copied from interface: MembershipService
      Get the MembershipProvider
      Specified by:
      getMembershipProvider in interface MembershipService
      Returns:
      MembershipProvider
    • setMembershipProvider

      public void setMembershipProvider(MembershipProvider memberProvider)
    • getConnectTimeout

      public int getConnectTimeout()
      Specified by:
      getConnectTimeout in interface CloudMembershipServiceMBean
    • setConnectTimeout

      public void setConnectTimeout(int connectTimeout)
    • getReadTimeout

      public int getReadTimeout()
      Specified by:
      getReadTimeout in interface CloudMembershipServiceMBean
    • setReadTimeout

      public void setReadTimeout(int readTimeout)
    • getExpirationTime

      public long getExpirationTime()
      Specified by:
      getExpirationTime in interface CloudMembershipServiceMBean
    • setExpirationTime

      public void setExpirationTime(long expirationTime)