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
Fields Modifier and Type Field Description protected static StringManager
sm
protected java.util.ArrayList<StaticMember>
staticMembers
-
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
Constructors Constructor Description StaticMembershipService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addStaticMember(StaticMember member)
protected StaticMembershipProvider
buildMembershipProvider()
int
getConnectTimeout()
long
getExpirationTime()
Member
getLocalMember(boolean incAliveTime)
Get the local member.MembershipProvider
getMembershipProvider()
Get the MembershipProviderlong
getPingInterval()
long
getRpcTimeout()
java.util.ArrayList<StaticMember>
getStaticMembers()
boolean
getUseThread()
void
removeStaticMember(StaticMember member)
void
setConnectTimeout(int connectTimeout)
protected void
setDefaults(java.util.Properties properties)
void
setDomain(byte[] domain)
void
setExpirationTime(long expirationTime)
void
setLocalMember(StaticMember member)
void
setLocalMemberProperties(java.lang.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(java.util.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)
Starts 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 Detail
-
sm
protected static final StringManager sm
-
staticMembers
protected final java.util.ArrayList<StaticMember> staticMembers
-
-
Method Detail
-
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 interfaceMembershipService
- 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.
-
buildMembershipProvider
protected StaticMembershipProvider buildMembershipProvider() throws java.lang.Exception
- Throws:
java.lang.Exception
-
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 interfaceMembershipService
- 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 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(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 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)
- Specified by:
setDomain
in interfaceMembershipService
-
getMembershipProvider
public MembershipProvider getMembershipProvider()
Description copied from interface:MembershipService
Get the MembershipProvider- Specified by:
getMembershipProvider
in interfaceMembershipService
- Returns:
- MembershipProvider
-
getStaticMembers
public java.util.ArrayList<StaticMember> getStaticMembers()
-
addStaticMember
public void addStaticMember(StaticMember member)
-
removeStaticMember
public void removeStaticMember(StaticMember member)
-
setLocalMember
public void setLocalMember(StaticMember member)
-
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
public void setProperties(java.util.Properties properties)
Description copied from class:MembershipServiceBase
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
protected void setDefaults(java.util.Properties properties)
-
-