Class StaticMembershipService
java.lang.Object
org.apache.catalina.tribes.membership.MembershipServiceBase
org.apache.catalina.tribes.membership.StaticMembershipService
- All Implemented Interfaces:
StaticMembershipServiceMBean
,MembershipListener
,MembershipService
public class StaticMembershipService
extends MembershipServiceBase
implements StaticMembershipServiceMBean
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final StringManager
protected final ArrayList<StaticMember>
Fields inherited from class org.apache.catalina.tribes.membership.MembershipServiceBase
channel, listener, properties
Fields inherited from interface org.apache.catalina.tribes.MembershipService
MBR_RX, MBR_TX
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addStaticMember
(StaticMember member) protected StaticMembershipProvider
int
long
getLocalMember
(boolean incAliveTime) Get the local member.Get the MembershipProviderlong
long
boolean
void
removeStaticMember
(StaticMember member) void
setConnectTimeout
(int connectTimeout) protected void
setDefaults
(Properties properties) void
setDomain
(byte[] domain) Set the associated domain.void
setExpirationTime
(long expirationTime) void
setLocalMember
(StaticMember member) void
setLocalMemberProperties
(String listenHost, int listenPort, int securePort, int udpPort) Sets the local member properties for broadcasting.void
setPayload
(byte[] payload) Set a payload to be broadcasted with each membership broadcast.void
setPingInterval
(long pingInterval) void
setProperties
(Properties properties) Sets the properties for the membership service.void
setRpcTimeout
(long rpcTimeout) void
setUseThread
(boolean useThread) void
start
(int level) Starts the membership service.void
stop
(int level) Stops the membership service.Methods inherited from class org.apache.catalina.tribes.membership.MembershipServiceBase
broadcast, findMemberByName, getChannel, getMember, getMembers, getMembersByName, getProperties, hasMembers, memberAdded, memberDisappeared, removeMembershipListener, setChannel, setMembershipListener, start
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.membership.StaticMembershipServiceMBean
findMemberByName, getMembersByName, getProperties, hasMembers
-
Field Details
-
sm
-
staticMembers
-
-
Constructor Details
-
StaticMembershipService
public StaticMembershipService()
-
-
Method Details
-
start
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 interfaceMembershipService
- 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.IllegalArgumentException
- if the level is incorrect.
-
buildMembershipProvider
- Throws:
Exception
-
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 interfaceMembershipService
- Parameters:
level
- - level MBR_RX stops listening for members, level MBR_TX stops broad casting the server
-
getLocalMember
Description copied from interface:MembershipService
Get the local member.- Specified by:
getLocalMember
in interfaceMembershipService
- 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 interfaceMembershipService
- Parameters:
listenHost
- Listen to hostlistenPort
- Listen to portsecurePort
- Use a secure portudpPort
- 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 interfaceMembershipService
- Parameters:
payload
- byte[]
-
setDomain
public void setDomain(byte[] domain) Description copied from interface:MembershipService
Set the associated domain.- Specified by:
setDomain
in interfaceMembershipService
- Parameters:
domain
- the domain
-
getMembershipProvider
Description copied from interface:MembershipService
Get the MembershipProvider- Specified by:
getMembershipProvider
in interfaceMembershipService
- Returns:
- MembershipProvider
-
getStaticMembers
-
addStaticMember
-
removeStaticMember
-
setLocalMember
-
getExpirationTime
public long getExpirationTime()- Specified by:
getExpirationTime
in interfaceStaticMembershipServiceMBean
-
setExpirationTime
public void setExpirationTime(long expirationTime) -
getConnectTimeout
public int getConnectTimeout()- Specified by:
getConnectTimeout
in interfaceStaticMembershipServiceMBean
-
setConnectTimeout
public void setConnectTimeout(int connectTimeout) -
getRpcTimeout
public long getRpcTimeout()- Specified by:
getRpcTimeout
in interfaceStaticMembershipServiceMBean
-
setRpcTimeout
public void setRpcTimeout(long rpcTimeout) -
getUseThread
public boolean getUseThread()- Specified by:
getUseThread
in interfaceStaticMembershipServiceMBean
-
setUseThread
public void setUseThread(boolean useThread) -
getPingInterval
public long getPingInterval()- Specified by:
getPingInterval
in interfaceStaticMembershipServiceMBean
-
setPingInterval
public void setPingInterval(long pingInterval) -
setProperties
Description copied from interface:MembershipService
Sets the properties for the membership service. This must be called before thestart()
method is called. The properties are implementation specific.- Specified by:
setProperties
in interfaceMembershipService
- Overrides:
setProperties
in classMembershipServiceBase
- Parameters:
properties
- - to be used to configure the membership service.
-
setDefaults
-