com.sun.enterprise.mgmt.transport
Class AbstractMessageSender
java.lang.Object
com.sun.enterprise.mgmt.transport.AbstractMessageSender
- All Implemented Interfaces:
- MessageSender, ShoalMessageSender
- Direct Known Subclasses:
- GrizzlyTCPConnectorWrapper, GrizzlyTCPMessageSender
public abstract class AbstractMessageSender
- extends Object
- implements MessageSender
This class implements a common 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
- Author:
- Bongjae Chang
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
localPeerID
protected PeerID localPeerID
- Represents local
PeerID.
This value should be assigned in real MessageSender's implementation correspoinding to the specific transport layer
AbstractMessageSender
public AbstractMessageSender()
send
public boolean send(PeerID peerID,
Message message)
throws IOException
- Sends the given
Message to the destination
- Specified by:
send in interface MessageSender
- Parameters:
peerID - the destination PeerID. null is not allowedmessage - a message which is sent to the peer
- Returns:
- true if the message is sent to the destination successfully, otherwise false
- Throws:
IOException - if I/O error occurs or given parameters are not valid
start
public void start()
throws IOException
-
- Specified by:
start in interface ShoalMessageSender
- Throws:
IOException
stop
public void stop()
throws IOException
-
- Specified by:
stop in interface ShoalMessageSender
- Throws:
IOException
doSend
protected abstract boolean doSend(PeerID peerID,
Message message)
throws IOException
- Sends the given
Message to the destination
- Parameters:
peerID - the destination PeerID. null is not allowedmessage - a message which is sent to the peer
- Returns:
- true if the message is sent to the destination successfully, otherwise false
- Throws:
IOException - if I/O error occurs or given parameters are not valid
Copyright © 2012. All Rights Reserved.