public class McastService extends MembershipServiceBase implements MessageListener, McastServiceMBean
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
domain |
protected McastServiceImpl |
impl
A handle to the actual low level implementation
|
protected MemberImpl |
localMember
The local member
|
protected MessageListener |
msglistener
A message listener delegate for broadcasts
|
protected byte[] |
payload |
protected static StringManager |
sm
The string manager for this package.
|
channel, listener, propertiesMBR_RX, MBR_TX| Constructor and Description |
|---|
McastService()
Create a membership service.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(ChannelMessage msg) |
void |
broadcast(ChannelMessage message)
Broadcasts a message to all members.
|
java.lang.String |
getAddress() |
java.lang.String |
getBind() |
byte[] |
getDomain() |
long |
getDropTime() |
long |
getFrequency() |
boolean |
getLocalLoopbackDisabled() |
Member |
getLocalMember(boolean alive)
Get the local member.
|
java.lang.String |
getLocalMemberName() |
MembershipProvider |
getMembershipProvider()
Get the MembershipProvider
|
byte[] |
getPayload() |
int |
getPort() |
int |
getRecoveryCounter() |
boolean |
getRecoveryEnabled() |
long |
getRecoverySleepTime() |
int |
getSoTimeout() |
int |
getTtl() |
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 |
messageReceived(ChannelMessage msg)
Receive a message from the IO components in the Channel stack
|
void |
removeMessageListener() |
void |
setAddress(java.lang.String addr) |
void |
setBind(java.lang.String bindaddr) |
protected void |
setDefaults(java.util.Properties properties) |
void |
setDomain(byte[] domain) |
void |
setDomain(java.lang.String domain) |
void |
setDropTime(long time) |
void |
setFrequency(long time) |
void |
setLocalLoopbackDisabled(boolean localLoopbackDisabled) |
void |
setLocalMemberProperties(java.lang.String listenHost,
int listenPort,
int securePort,
int udpPort)
Sets the local member properties for broadcasting.
|
void |
setMcastBindAddress(java.lang.String bindaddr) |
void |
setMcastDropTime(long time) |
void |
setMessageListener(MessageListener listener) |
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(int level)
Starts the membership service.
|
void |
stop(int svc)
Stop broadcasting and listening to membership pings
|
findMemberByName, getChannel, getMember, getMembers, getMembersByName, getProperties, hasMembers, memberAdded, memberDisappeared, removeMembershipListener, setChannel, setMembershipListener, startclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindMemberByName, getMembersByName, getProperties, hasMembersprotected static final StringManager sm
protected McastServiceImpl impl
protected MessageListener msglistener
protected MemberImpl localMember
protected byte[] payload
protected byte[] domain
public void setProperties(java.util.Properties properties)
setProperties in interface MembershipServicesetProperties in class MembershipServiceBaseproperties - java.lang.IllegalArgumentException - if a property is missing.public java.lang.String getLocalMemberName()
getLocalMemberName in interface McastServiceMBeanpublic Member getLocalMember(boolean alive)
getLocalMember in interface MembershipServicealive - true to set the alive time
on the local memberpublic void setLocalMemberProperties(java.lang.String listenHost,
int listenPort,
int securePort,
int udpPort)
setLocalMemberProperties in interface MembershipServicelistenHost - Listen to hostlistenPort - Listen to portsecurePort - Use a secure portudpPort - Use UDPpublic void setAddress(java.lang.String addr)
public java.lang.String getAddress()
getAddress in interface McastServiceMBeanpublic void setMcastBindAddress(java.lang.String bindaddr)
public void setBind(java.lang.String bindaddr)
public java.lang.String getBind()
getBind in interface McastServiceMBeanpublic void setPort(int port)
public void setRecoveryCounter(int recoveryCounter)
public int getRecoveryCounter()
getRecoveryCounter in interface McastServiceMBeanpublic void setRecoveryEnabled(boolean recoveryEnabled)
public boolean getRecoveryEnabled()
getRecoveryEnabled in interface McastServiceMBeanpublic void setRecoverySleepTime(long recoverySleepTime)
public long getRecoverySleepTime()
getRecoverySleepTime in interface McastServiceMBeanpublic void setLocalLoopbackDisabled(boolean localLoopbackDisabled)
public boolean getLocalLoopbackDisabled()
getLocalLoopbackDisabled in interface McastServiceMBeanpublic int getPort()
getPort in interface McastServiceMBeanpublic void setFrequency(long time)
public long getFrequency()
getFrequency in interface McastServiceMBeanpublic void setMcastDropTime(long time)
public void setDropTime(long time)
public long getDropTime()
getDropTime in interface McastServiceMBeanprotected void hasProperty(java.util.Properties properties,
java.lang.String name)
properties - The set of propertiesname - The property to check forpublic void start(int level)
throws java.lang.Exception
MembershipServicestart in interface MembershipServicelevel - - level MBR_RX starts listening for members, level MBR_TX
starts broad casting the serverjava.lang.Exception - if the service fails to start.java.lang.IllegalArgumentException - if the level is incorrect.public void stop(int svc)
stop in interface MembershipServicesvc - - level MBR_RX stops listening for members, level MBR_TX
stops broad casting the serverpublic void setMessageListener(MessageListener listener)
public void removeMessageListener()
public void messageReceived(ChannelMessage msg)
MessageListenermessageReceived in interface MessageListenermsg - ChannelMessagepublic boolean accept(ChannelMessage msg)
accept in interface MessageListenerpublic void broadcast(ChannelMessage message) throws ChannelException
MembershipServicebroadcast in interface MembershipServicebroadcast in class MembershipServiceBasemessage - The message to broadcastChannelException - Message broadcast failedpublic int getSoTimeout()
getSoTimeout in interface McastServiceMBeanpublic void setSoTimeout(int mcastSoTimeout)
public int getTtl()
getTtl in interface McastServiceMBeanpublic byte[] getPayload()
public byte[] getDomain()
getDomain in interface McastServiceMBeanpublic void setTtl(int mcastTTL)
public void setPayload(byte[] payload)
MembershipServicesetPayload in interface MembershipServicepayload - byte[]public void setDomain(byte[] domain)
setDomain in interface MembershipServicepublic void setDomain(java.lang.String domain)
public MembershipProvider getMembershipProvider()
MembershipServicegetMembershipProvider in interface MembershipServiceprotected void setDefaults(java.util.Properties properties)
public static void main(java.lang.String[] args)
throws java.lang.Exception
args - Command-line argumentsjava.lang.Exception - If an error occursCopyright © 2000-2019 Apache Software Foundation. All Rights Reserved.