public class LWRMulticast extends Object implements MessageListener
| Modifier and Type | Field and Description |
|---|---|
static String |
ACKTAG
Ack message element name
|
protected MessageListener |
msgListener
The application message listener
|
static String |
SEQTAG
seq number message element name
|
static String |
SRCIDTAG
source node id message element name
|
| Constructor and Description |
|---|
LWRMulticast(ClusterManager manager,
MessageListener msgListener)
Create a multicast channel bind it to a specific pipe within specified
peer group
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this LWRMulticast.
|
Set<PeerID> |
getAckList()
Returns a list of ack's received from nodes identified by PeerID's
|
static long |
getSequenceID(Message msg)
returns the source peer id of a message
|
long |
getSoTimeout()
Gets the Timeout attribute of the LWRMulticast
|
static PeerID |
getSource(Message msg)
returns the source peer id of a message
|
int |
getType()
Returns the message type which
Message is supporting
i.g. |
boolean |
isBound()
Returns the binding state of the LWRMulticast.
|
boolean |
isClosed()
Returns the closed state of the LWRMulticast.
|
void |
joinGroup(ClusterManager manager,
MessageListener msgListener)
joins MutlicastSocket to specified pipe within the context of group
|
void |
receiveMessageEvent(MessageEvent event)
Processing a
MessageEvent |
void |
send(Message msg,
int threshold)
Send a message to the predefined set of nodes, and expect a minimum of specified acks.
|
boolean |
send(PeerID pid,
Message msg)
Send a message.
|
boolean |
send(Set<PeerID> ids,
Message msg)
Send a message to a set of peers
|
void |
setSoTimeout(long timeout)
Sets the Timeout attribute of the LWRMulticast
a timeout of 0 blocks forever, by default this channel's
timeout is set to 0
|
public static final String ACKTAG
public static final String SEQTAG
public static final String SRCIDTAG
protected transient MessageListener msgListener
public LWRMulticast(ClusterManager manager, MessageListener msgListener) throws IOException
manager - the ClusterMangermsgListener - the application listenerIOException - if an io error occurspublic void joinGroup(ClusterManager manager, MessageListener msgListener) throws IOException
manager - the ClusterMangermsgListener - The application message listenerIOException - if an io error occurspublic boolean isBound()
public void close()
public void receiveMessageEvent(MessageEvent event) throws MessageIOException
MessageEventreceiveMessageEvent in interface MessageListenerevent - a received message eventMessageIOException - if I/O error occurspublic int getType()
MessageListenerMessage is supporting
i.g. Message.TYPE_CLUSTER_MANAGER_MESSAGE or Message.TYPE_HEALTH_MONITOR_MESSAGE's integer value or etc...getType in interface MessageListenerpublic Set<PeerID> getAckList()
public long getSoTimeout()
public void setSoTimeout(long timeout)
throws IOException
timeout - The new soTimeout valueIOException - if an I/O error occurspublic boolean isClosed()
public static long getSequenceID(Message msg)
msg - messagepublic static PeerID getSource(Message msg)
msg - messagepublic void send(Message msg, int threshold) throws IOException
This method blocks until ack's upto to the specified threshold have been received or the timeout has been reached. A call to getAckList() returns a list of ack source peer ID's
msg - the message to sendthreshold - the minimun of ack expected, 0 indicates none are expectedIOException - if an i/o error occurs, or SocketTimeoutException
if the threshold is not met within timeoutpublic boolean send(PeerID pid, Message msg) throws IOException
pid - destination PeerIDmsg - the message to sendtrue if the message has been sent otherwise
false. false. is commonly returned for
non-error related congestion, meaning that you should be able to send
the message after waiting some amount of time.IOException - if an i/o error occurspublic boolean send(Set<PeerID> ids, Message msg) throws IOException
ids - destination PeerIDsmsg - the message to sendtrue if the message has been sent otherwise
false. false. is commonly returned for
non-error related congestion, meaning that you should be able to send
the message after waiting some amount of time.IOException - if an i/o error occursCopyright © 2017–2019 Eclipse Foundation. All rights reserved.