|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.catalina.tribes.membership.McastService
public class McastService
A membership implementation using simple multicast. This is the representation of a multicast membership service. This class is responsible for maintaining a list of active cluster nodes in the cluster. If a node fails to send out a heartbeat, the node will be dismissed.
Field Summary | |
---|---|
protected byte[] |
domain
|
protected static Member[] |
EMPTY_MEMBERS
Return all the members |
protected McastServiceImpl |
impl
A handle to the actual low level implementation |
protected MembershipListener |
listener
A membership listener delegate (should be the cluster :) |
protected MemberImpl |
localMember
The local member |
protected byte[] |
payload
|
protected java.util.Properties |
properties
The implementation specific properties |
protected StringManager |
sm
The string manager for this package. |
Fields inherited from interface org.apache.catalina.tribes.MembershipService |
---|
MBR_RX, MBR_TX |
Constructor Summary | |
---|---|
McastService()
Create a membership service. |
Method Summary | |
---|---|
Member |
findMemberByName(java.lang.String name)
Return the member by name |
java.lang.String |
getAddress()
|
java.lang.String |
getBind()
|
byte[] |
getDomain()
|
long |
getDropTime()
|
long |
getFrequency()
|
java.lang.String |
getInfo()
Return descriptive information about this implementation and the corresponding version number, in the format <description>/<version> . |
Member |
getLocalMember(boolean alive)
Return the local member |
java.lang.String |
getLocalMemberName()
Return the local member name |
java.lang.String |
getMcastAddr()
Deprecated. use getAddress |
java.lang.String |
getMcastBindAddress()
Deprecated. use getBind |
long |
getMcastDropTime()
Deprecated. use getDropTime |
long |
getMcastFrequency()
Deprecated. use getFrequency |
int |
getMcastPort()
Deprecated. use getPort() |
int |
getMcastSoTimeout()
Deprecated. use getSoTimeout |
int |
getMcastTTL()
Deprecated. use getTtl |
Member |
getMember(Member mbr)
|
Member[] |
getMembers()
Returns a list of all the members in the cluster. |
java.lang.String[] |
getMembersByName()
Return all the members by name |
byte[] |
getPayload()
|
int |
getPort()
|
java.util.Properties |
getProperties()
Return the properties, see setProperties |
int |
getSoTimeout()
|
int |
getTtl()
|
boolean |
hasMembers()
has members? |
protected void |
hasProperty(java.util.Properties properties,
java.lang.String name)
Check if a required property is available. |
static void |
main(java.lang.String[] args)
Simple test program |
void |
memberAdded(Member member)
A member was added to the group |
void |
memberDisappeared(Member member)
Callback from the impl when a new member has been received |
void |
removeMembershipListener()
Remove the membership listener |
void |
setAddress(java.lang.String addr)
|
void |
setBind(java.lang.String bindaddr)
|
void |
setDomain(byte[] domain)
|
void |
setDomain(java.lang.String domain)
|
void |
setDropTime(long time)
|
void |
setFrequency(long time)
|
void |
setLocalMemberProperties(java.lang.String listenHost,
int listenPort)
Sets the local member properties for broadcasting |
void |
setMcastAddr(java.lang.String addr)
Deprecated. use setAddress |
void |
setMcastBindAddress(java.lang.String bindaddr)
|
void |
setMcastDropTime(long time)
|
void |
setMcastFrequency(long time)
Deprecated. use setFrequency |
void |
setMcastPort(int port)
Deprecated. use setPort |
void |
setMcastSoTimeout(int mcastSoTimeout)
Deprecated. use setSoTimeout |
void |
setMcastTTL(int mcastTTL)
Deprecated. use setTtl |
void |
setMembershipListener(MembershipListener listener)
Add a membership listener, this version only supports one listener per service, so calling this method twice will result in only the second listener being active. |
void |
setPayload(byte[] payload)
Set a payload to be broadcasted with each membership broadcast. |
void |
setPort(int port)
|
void |
setProperties(java.util.Properties properties)
Sets the properties for the membership service. |
void |
setRecoveryCounter(int recoveryCounter)
|
void |
setRecoveryEnabled(boolean recoveryEnabled)
|
void |
setRecoverySleepTime(long recoverySleepTime)
|
void |
setSoTimeout(int mcastSoTimeout)
|
void |
setTtl(int mcastTTL)
|
void |
start()
Start broadcasting and listening to membership pings |
void |
start(int level)
Starts the membership service. |
void |
stop(int svc)
Stop broadcasting and listening to membership pings |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected StringManager sm
protected java.util.Properties properties
protected McastServiceImpl impl
protected MembershipListener listener
protected MemberImpl localMember
protected byte[] payload
protected byte[] domain
protected static final Member[] EMPTY_MEMBERS
Constructor Detail |
---|
public McastService()
Method Detail |
---|
public java.lang.String getInfo()
<description>/<version>
.
public void setProperties(java.util.Properties properties)
MembershipService
start()
method is called.
The properties are implementation specific.
setProperties
in interface MembershipService
properties
- java.lang.IllegalArgumentException
- if a property is missing.public java.util.Properties getProperties()
getProperties
in interface MembershipService
public java.lang.String getLocalMemberName()
public Member getLocalMember(boolean alive)
getLocalMember
in interface MembershipService
public void setLocalMemberProperties(java.lang.String listenHost, int listenPort)
setLocalMemberProperties
in interface MembershipService
public void setAddress(java.lang.String addr)
public void setMcastAddr(java.lang.String addr)
addr
- Stringpublic java.lang.String getAddress()
public java.lang.String getMcastAddr()
public void setMcastBindAddress(java.lang.String bindaddr)
public void setBind(java.lang.String bindaddr)
public java.lang.String getMcastBindAddress()
public java.lang.String getBind()
public void setMcastPort(int port)
port
- intpublic void setPort(int port)
public void setRecoveryCounter(int recoveryCounter)
public void setRecoveryEnabled(boolean recoveryEnabled)
public void setRecoverySleepTime(long recoverySleepTime)
public int getMcastPort()
public int getPort()
public void setMcastFrequency(long time)
time
- longpublic void setFrequency(long time)
public long getMcastFrequency()
public long getFrequency()
public void setMcastDropTime(long time)
public void setDropTime(long time)
public long getMcastDropTime()
public long getDropTime()
protected void hasProperty(java.util.Properties properties, java.lang.String name)
properties
- The set of propertiesname
- The property to check forpublic void start() throws java.lang.Exception
start
in interface MembershipService
java.lang.Exception
- if a IO error occurspublic void start(int level) throws java.lang.Exception
MembershipService
start
in interface MembershipService
level
- - level MBR_RX starts listening for members, level MBR_TX
starts broad casting the server
java.lang.Exception
- if the service fails to start.
java.lang.IllegalArgumentException
- if the level is incorrect.public void stop(int svc)
stop
in interface MembershipService
svc
- - level MBR_RX stops listening for members, level MBR_TX
stops broad casting the serverpublic java.lang.String[] getMembersByName()
getMembersByName
in interface MembershipService
public Member findMemberByName(java.lang.String name)
findMemberByName
in interface MembershipService
public boolean hasMembers()
hasMembers
in interface MembershipService
public Member getMember(Member mbr)
getMember
in interface MembershipService
mbr
- Member
public Member[] getMembers()
MembershipService
getMembers
in interface MembershipService
public void setMembershipListener(MembershipListener listener)
setMembershipListener
in interface MembershipService
listener
- The listenerpublic void removeMembershipListener()
removeMembershipListener
in interface MembershipService
public void memberAdded(Member member)
MembershipListener
memberAdded
in interface MembershipListener
member
- Member - the member that was addedpublic void memberDisappeared(Member member)
memberDisappeared
in interface MembershipListener
member
- The memberMember.SHUTDOWN_PAYLOAD
public int getMcastSoTimeout()
public int getSoTimeout()
public void setMcastSoTimeout(int mcastSoTimeout)
mcastSoTimeout
- intpublic void setSoTimeout(int mcastSoTimeout)
public int getMcastTTL()
public int getTtl()
public byte[] getPayload()
public byte[] getDomain()
public void setMcastTTL(int mcastTTL)
mcastTTL
- intpublic void setTtl(int mcastTTL)
public void setPayload(byte[] payload)
MembershipService
setPayload
in interface MembershipService
payload
- byte[]public void setDomain(byte[] domain)
setDomain
in interface MembershipService
public void setDomain(java.lang.String domain)
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- Command-line arguments
java.lang.Exception
- If an error occurs
|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |