Class CloudMembershipProvider
java.lang.Object
org.apache.catalina.tribes.membership.MembershipProviderBase
org.apache.catalina.tribes.membership.cloud.CloudMembershipProvider
- All Implemented Interfaces:
ChannelListener
,Heartbeat
,MembershipProvider
- Direct Known Subclasses:
DNSMembershipProvider
,KubernetesMembershipProvider
public abstract class CloudMembershipProvider
extends MembershipProviderBase
implements Heartbeat, ChannelListener
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected static final String
protected long
protected String
protected MessageDigest
protected int
protected int
protected static final StringManager
protected Instant
protected StreamProvider
protected String
Fields inherited from class org.apache.catalina.tribes.membership.MembershipProviderBase
executor, membership, membershipListener, service
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
accept
(Serializable msg, Member sender) Invoked by the channel to determine if the listener will process this message or not.protected abstract Member[]
Fetch current cluster members from the cloud orchestration.protected static String
Get value of environment variable.protected String
Get the Kubernetes namespace, or "tomcat" if the Kubernetes environment variable cannot be found (with a warning log about the missing namespace).void
Heartbeat invocation for resources cleanup etcvoid
init
(Properties properties) void
messageReceived
(Serializable msg, Member sender) Receive a message from the channelvoid
start
(int level) boolean
stop
(int level) protected void
updateMember
(Member member, boolean add) Add or remove specified member.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
-
Field Details
-
sm
-
CUSTOM_ENV_PREFIX
- See Also:
-
url
-
streamProvider
-
connectionTimeout
protected int connectionTimeout -
readTimeout
protected int readTimeout -
startTime
-
md5
-
headers
-
localIp
-
port
protected int port -
expirationTime
protected long expirationTime
-
-
Constructor Details
-
CloudMembershipProvider
public CloudMembershipProvider()
-
-
Method Details
-
getEnv
Get value of environment variable.- Parameters:
keys
- the environment variables- Returns:
- the env variables values, or null if not found
-
getNamespace
Get the Kubernetes namespace, or "tomcat" if the Kubernetes environment variable cannot be found (with a warning log about the missing namespace).- Returns:
- the namespace
-
init
- Specified by:
init
in interfaceMembershipProvider
- Overrides:
init
in classMembershipProviderBase
- Throws:
IOException
-
start
- Specified by:
start
in interfaceMembershipProvider
- Throws:
Exception
-
stop
- Specified by:
stop
in interfaceMembershipProvider
- Throws:
Exception
-
heartbeat
public void heartbeat()Description copied from interface:Heartbeat
Heartbeat invocation for resources cleanup etc -
fetchMembers
Fetch current cluster members from the cloud orchestration.- Returns:
- the member array
-
updateMember
Add or remove specified member.- Parameters:
member
- the member to addadd
- true if the member is added, false otherwise
-
messageReceived
Description copied from interface:ChannelListener
Receive a message from the channel- Specified by:
messageReceived
in interfaceChannelListener
- Parameters:
msg
- Serializablesender
- - the source of the message
-
accept
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
- Parameters:
msg
- Serializablesender
- Member- Returns:
- boolean
-