Class DNSMembershipProvider
- java.lang.Object
-
- org.apache.catalina.tribes.membership.MembershipProviderBase
-
- org.apache.catalina.tribes.membership.cloud.CloudMembershipProvider
-
- org.apache.catalina.tribes.membership.cloud.DNSMembershipProvider
-
- All Implemented Interfaces:
ChannelListener
,Heartbeat
,MembershipProvider
public class DNSMembershipProvider extends CloudMembershipProvider
AMembershipProvider
that uses DNS to retrieve the members of a cluster.
Configuration example for Kubernetes
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" membershipProviderClassName="org.apache.catalina.tribes.membership.cloud.DNSMembershipProvider"/> </Channel> </Cluster> ...
dns-membership-service.yml
apiVersion: v1 kind: Service metadata: annotations: service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" description: "The service for tomcat cluster membership." name: my-tomcat-app-membership spec: clusterIP: None ports: - name: membership port: 8888 selector: app: my-tomcat-app
DNS_MEMBERSHIP_SERVICE_NAME=my-tomcat-app-membership
-
-
Field Summary
-
Fields inherited from class org.apache.catalina.tribes.membership.cloud.CloudMembershipProvider
connectionTimeout, CUSTOM_ENV_PREFIX, expirationTime, headers, localIp, md5, port, readTimeout, sm, startTime, streamProvider, url
-
Fields inherited from class org.apache.catalina.tribes.membership.MembershipProviderBase
executor, membership, membershipListener, service
-
-
Constructor Summary
Constructors Constructor Description DNSMembershipProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(java.io.Serializable msg, Member sender)
Invoked by the channel to determine if the listener will process this message or not.protected Member[]
fetchMembers()
Fetch current cluster members from the cloud orchestration.void
start(int level)
boolean
stop(int level)
-
Methods inherited from class org.apache.catalina.tribes.membership.cloud.CloudMembershipProvider
getEnv, getNamespace, heartbeat, init, messageReceived, updateMember
-
Methods inherited from class org.apache.catalina.tribes.membership.MembershipProviderBase
getMember, getMembers, hasMembers, setMembershipListener, setMembershipService
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.catalina.tribes.ChannelListener
equals, hashCode
-
-
-
-
Method Detail
-
start
public void start(int level) throws java.lang.Exception
- Specified by:
start
in interfaceMembershipProvider
- Overrides:
start
in classCloudMembershipProvider
- Throws:
java.lang.Exception
-
stop
public boolean stop(int level) throws java.lang.Exception
- Specified by:
stop
in interfaceMembershipProvider
- Overrides:
stop
in classCloudMembershipProvider
- Throws:
java.lang.Exception
-
fetchMembers
protected Member[] fetchMembers()
Description copied from class:CloudMembershipProvider
Fetch current cluster members from the cloud orchestration.- Specified by:
fetchMembers
in classCloudMembershipProvider
- Returns:
- the member array
-
accept
public boolean accept(java.io.Serializable msg, Member sender)
Description copied from interface:ChannelListener
Invoked by the channel to determine if the listener will process this message or not.- Specified by:
accept
in interfaceChannelListener
- Overrides:
accept
in classCloudMembershipProvider
- Parameters:
msg
- Serializablesender
- Member- Returns:
- boolean
-
-