public abstract class AbstractMessageSender extends Object implements MessageSender
MessageSender logic simply in order to help the specific transport layer to be implemented easily
Mainly, this stores both source's PeerID and target's PeerID before sending the message to the peer| Modifier and Type | Field and Description |
|---|---|
protected PeerID |
localPeerID
Represents local
PeerID. |
TCP_TRANSPORT, UDP_TRANSPORT| Constructor and Description |
|---|
AbstractMessageSender() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract boolean |
doSend(PeerID peerID,
Message message)
Sends the given
Message to the destination |
boolean |
send(PeerID peerID,
Message message)
Sends the given
Message to the destination |
void |
start() |
void |
stop() |
protected PeerID localPeerID
PeerID.
This value should be assigned in real MessageSender's implementation correspoinding to the specific transport layerpublic boolean send(PeerID peerID, Message message) throws IOException
Message to the destinationsend in interface MessageSenderpeerID - the destination PeerID. null is not allowedmessage - a message which is sent to the peerIOException - if I/O error occurs or given parameters are not validpublic void start()
throws IOException
start in interface ShoalMessageSenderIOExceptionpublic void stop()
throws IOException
stop in interface ShoalMessageSenderIOExceptionprotected abstract boolean doSend(PeerID peerID, Message message) throws IOException
Message to the destinationpeerID - the destination PeerID. null is not allowedmessage - a message which is sent to the peerIOException - if I/O error occurs or given parameters are not validCopyright © 2017–2019 Eclipse Foundation. All rights reserved.