public interface MembershipService
MembershipService
interface is the membership component
at the bottom layer, the IO layer (for layers see the javadoc for the Channel
interface).Modifier and Type | Method and Description |
---|---|
void |
broadcast(ChannelMessage message)
Broadcasts a message to all members.
|
Member |
findMemberByName(String name)
Get a member.
|
Channel |
getChannel()
Return the channel that is related to this MembershipService
|
Member |
getLocalMember(boolean incAliveTime)
Get the local member.
|
Member |
getMember(Member mbr)
Retrieve the specified member from the membership.
|
Member[] |
getMembers() |
String[] |
getMembersByName() |
Properties |
getProperties() |
boolean |
hasMembers() |
void |
removeMembershipListener()
Removes the membership listener.
|
void |
setChannel(Channel channel)
Set the channel that is related to this MembershipService
|
void |
setDomain(byte[] domain) |
void |
setLocalMemberProperties(String listenHost,
int listenPort,
int securePort,
int udpPort)
Sets the local member properties for broadcasting.
|
void |
setMembershipListener(MembershipListener listener)
Sets the membership listener, only one listener can be added.
|
void |
setPayload(byte[] payload)
Set a payload to be broadcasted with each membership
broadcast.
|
void |
setProperties(Properties properties)
Sets the properties for the membership service.
|
void |
start()
Starts the membership service.
|
void |
start(int level)
Starts the membership service.
|
void |
stop(int level)
Starts the membership service.
|
static final int MBR_RX
static final int MBR_TX
void setProperties(Properties properties)
start()
method is called.
The properties are implementation specific.properties
- - to be used to configure the membership service.Properties getProperties()
void start() throws Exception
Exception
- if the service fails to start.void start(int level) throws Exception
level
- - level MBR_RX starts listening for members, level MBR_TX
starts broad casting the serverException
- if the service fails to start.IllegalArgumentException
- if the level is incorrect.void stop(int level)
level
- - level MBR_RX stops listening for members, level MBR_TX
stops broad casting the serverIllegalArgumentException
- if the level is incorrect.boolean hasMembers()
Member getMember(Member mbr)
mbr
- The member to retrieveMember[] getMembers()
Member getLocalMember(boolean incAliveTime)
incAliveTime
- true
to set the alive time
on the local memberString[] getMembersByName()
Member findMemberByName(String name)
name
- The member namevoid setLocalMemberProperties(String listenHost, int listenPort, int securePort, int udpPort)
listenHost
- Listen to hostlistenPort
- Listen to portsecurePort
- Use a secure portudpPort
- Use UDPvoid setMembershipListener(MembershipListener listener)
listener
- The listenervoid removeMembershipListener()
void setPayload(byte[] payload)
payload
- byte[]void setDomain(byte[] domain)
void broadcast(ChannelMessage message) throws ChannelException
message
- The message to broadcastChannelException
- Message broadcast failedChannel getChannel()
void setChannel(Channel channel)
channel
- The channelCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.