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(java.lang.String name)
Return the member by name
|
Member |
getLocalMember(boolean incAliveTime)
Returns the member object that defines this member
|
Member |
getMember(Member mbr) |
Member[] |
getMembers()
Returns a list of all the members in the cluster.
|
java.lang.String[] |
getMembersByName()
Return all members by name
|
java.util.Properties |
getProperties()
Returns the properties for the configuration used.
|
boolean |
hasMembers() |
void |
removeMembershipListener()
removes the membership listener.
|
void |
setDomain(byte[] domain) |
void |
setLocalMemberProperties(java.lang.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(java.util.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(java.util.Properties properties)
start()
method is called.
The properties are implementation specific.properties
- - to be used to configure the membership service.java.util.Properties getProperties()
void start() throws java.lang.Exception
java.lang.Exception
- if the service fails to start.void start(int level) throws java.lang.Exception
level
- - 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.void stop(int level)
level
- - level MBR_RX stops listening for members, level MBR_TX
stops broad casting the serverjava.lang.IllegalArgumentException
- if the level is incorrect.boolean hasMembers()
Member[] getMembers()
Member getLocalMember(boolean incAliveTime)
java.lang.String[] getMembersByName()
Member findMemberByName(java.lang.String name)
void setLocalMemberProperties(java.lang.String listenHost, int listenPort, int securePort, int udpPort)
void setMembershipListener(MembershipListener listener)
listener
- The listenervoid removeMembershipListener()
void setPayload(byte[] payload)
payload
- byte[]void setDomain(byte[] domain)
void broadcast(ChannelMessage message) throws ChannelException
message
- ChannelException
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.