net.jxta.impl.endpoint.cbjx
Class CbJxMessenger
java.lang.Object
net.jxta.util.AbstractSimpleSelectable
net.jxta.endpoint.AbstractMessenger
net.jxta.impl.endpoint.BlockingMessenger
net.jxta.impl.endpoint.cbjx.CbJxMessenger
- All Implemented Interfaces:
- Messenger, SimpleSelectable
public class CbJxMessenger
- extends BlockingMessenger
This class is the Messenger used to send CbJx Messages
Fields inherited from interface net.jxta.endpoint.Messenger |
ANYSTATE, BREAKING, BROKEN, CLOSED, CLOSING, CONNECTED, DISCONNECTED, DISCONNECTING, IDLE, RECONCLOSING, RECONNECTING, RECONSATURATED, RESOLCLOSING, RESOLPENDING, RESOLSATURATED, RESOLVED, RESOLVING, SATURATED, SENDING, SENDINGSATURATED, TERMINAL, UNRESOLVABLE, UNRESOLVED, UNRESOLVING, USABLE |
Methods inherited from class net.jxta.impl.endpoint.BlockingMessenger |
close, getChannelMessenger, getDestAddressToUse, getLogicalDestinationAddress, getState, isClosed, resolve, sendMessageB, sendMessageN, setOwner, shutdown |
Methods inherited from class net.jxta.endpoint.AbstractMessenger |
flush, getDestinationAddress, getDestinationAddressObject, getMTU, isIdle, isSynchronous, itemChanged, sendMessage, sendMessage, sendMessage, setStateLock, toString, waitState |
CbJxMessenger
public CbJxMessenger(CbJxTransport transport,
EndpointAddress dest,
Object hintIgnored)
throws IOException
- constructor
- Parameters:
dest
- the destination address
- Throws:
IOException
CbJxMessenger
public CbJxMessenger(CbJxTransport transport,
EndpointAddress dest)
throws IOException
- constructor
- Parameters:
dest
- the destination address
- Throws:
IOException
closeImpl
public void closeImpl()
- Close connection. May fail current send.
- Specified by:
closeImpl
in class BlockingMessenger
getLogicalDestinationImpl
public EndpointAddress getLogicalDestinationImpl()
- Obtain the logical destination address from the implementer (a transport for example).
- Specified by:
getLogicalDestinationImpl
in class BlockingMessenger
isIdleImpl
public boolean isIdleImpl()
- return true if this messenger has not been used for a long time. The definition of long time is: "sufficient such that closing it
is worth the cost of having to re-open". A messenger should self close if it thinks it meets the definition of
idle. BlockingMessenger leaves the evaluation to the transport but does the work automatically. Important: if
self destruction is used, this method must work; not just return false. See the constructor. In general, if closeImpl does
not need to do anything, then self destruction is not needed.
Since CbJx is a virtual transport and consumes very few resources there
is no point to doing idle teardown.
- Specified by:
isIdleImpl
in class BlockingMessenger
- Returns:
true
if theis messenger is, by it's own definition, idle.
sendMessageBImpl
public void sendMessageBImpl(Message msg,
String service,
String serviceParam)
throws IOException
- Send a message blocking as needed until the message is sent.
- Specified by:
sendMessageBImpl
in class BlockingMessenger
- Parameters:
msg
- The message to send.service
- The destination service.serviceParam
- The destination serivce param.
- Throws:
IOException
- Thrown for errors encountered while sending the message.
sendTo
void sendTo(Message msg)
throws IOException
- Send a message via the underlying messenger.
- Parameters:
msg
- The message to send to the remote peer.
- Throws:
IOException
- if there was a problem sending the message.