Class AbstractMultiMessageSender
- java.lang.Object
-
- com.sun.enterprise.mgmt.transport.AbstractMultiMessageSender
-
- All Implemented Interfaces:
MessageSender,MulticastMessageSender,ShoalMessageSender
- Direct Known Subclasses:
JxtaPipeManagerWrapper
public abstract class AbstractMultiMessageSender extends java.lang.Object implements MulticastMessageSender, MessageSender
This class implements both a commonMulticastMessageSenderandMessageSenderlogic simply in order to help the specific transport layer to be implemented easily Mainly, this stores both source'sPeerIDand target'sPeerIDbefore sending the message to the peer or broadcasting the message to all members- Author:
- Bongjae Chang
-
-
Field Summary
Fields Modifier and Type Field Description protected PeerIDlocalPeerIDRepresents localPeerID.-
Fields inherited from interface com.sun.enterprise.mgmt.transport.ShoalMessageSender
TCP_TRANSPORT, UDP_TRANSPORT
-
-
Constructor Summary
Constructors Constructor Description AbstractMultiMessageSender()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanbroadcast(Message message)Broadcasts or Multicasts the givenMessageto all membersprotected abstract booleandoBroadcast(Message message)Broadcasts or Multicasts the givenMessageto all membersprotected abstract booleandoSend(PeerID peerID, Message message)Sends the givenMessageto the destinationbooleansend(PeerID peerID, Message message)Sends the givenMessageto the destinationvoidstart()voidstop()
-
-
-
Field Detail
-
localPeerID
protected PeerID localPeerID
Represents localPeerID. This value should be assigned in realMessageSender's implementation correspoinding to the specific transport layer
-
-
Method Detail
-
broadcast
public boolean broadcast(Message message) throws java.io.IOException
Broadcasts or Multicasts the givenMessageto all members- Specified by:
broadcastin interfaceMulticastMessageSender- Parameters:
message- a message which is sent to all members- Returns:
- true if the message is sent to all members successfully, otherwise false
- Throws:
java.io.IOException- if I/O error occurs or given parameters are not valid
-
send
public boolean send(PeerID peerID, Message message) throws java.io.IOException
Sends the givenMessageto the destination- Specified by:
sendin interfaceMessageSender- Parameters:
peerID- the destinationPeerID.nullis not allowedmessage- a message which is sent to the peer- Returns:
- true if the message is sent to the destination successfully, otherwise false
- Throws:
java.io.IOException- if I/O error occurs or given parameters are not valid
-
start
public void start() throws java.io.IOException- Specified by:
startin interfaceShoalMessageSender- Throws:
java.io.IOException
-
stop
public void stop() throws java.io.IOException- Specified by:
stopin interfaceShoalMessageSender- Throws:
java.io.IOException
-
doBroadcast
protected abstract boolean doBroadcast(Message message) throws java.io.IOException
Broadcasts or Multicasts the givenMessageto all members- Parameters:
message- a message which is sent to all members- Returns:
- true if the message is sent to all members successfully, otherwise false
- Throws:
java.io.IOException- if I/O error occurs or given parameters are not valid
-
doSend
protected abstract boolean doSend(PeerID peerID, Message message) throws java.io.IOException
Sends the givenMessageto the destination- Parameters:
peerID- the destinationPeerID.nullis not allowedmessage- a message which is sent to the peer- Returns:
- true if the message is sent to the destination successfully, otherwise false
- Throws:
java.io.IOException- if I/O error occurs or given parameters are not valid
-
-