|
JXTA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.jxta.util.AbstractSimpleSelectable
net.jxta.endpoint.AbstractMessenger
net.jxta.impl.endpoint.BlockingMessenger
net.jxta.impl.endpoint.tcp.TcpMessenger
public class TcpMessenger
Implements a messenger which sends messages via raw TCP sockets.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface net.jxta.util.SimpleSelectable |
|---|
SimpleSelectable.IdentityReference |
| Field Summary | |
|---|---|
(package private) long |
receiveBeginTime
Time at which we began receiving the current incoming message. |
| Fields inherited from class net.jxta.endpoint.AbstractMessenger |
|---|
DEFAULT_MTU |
| Fields inherited from class net.jxta.util.AbstractSimpleSelectable |
|---|
identityReference |
| 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 |
| Constructor Summary | |
|---|---|
TcpMessenger(EndpointAddress destaddr,
TcpTransport tcpTransport)
Create a new TcpMessenger for the specified address. |
|
TcpMessenger(EndpointAddress destaddr,
TcpTransport tcpTransport,
boolean selfDestruct)
Create a new TcpMessenger for the specified address. |
|
TcpMessenger(SocketChannel socketChannel,
TcpTransport transport)
Create a new TcpMessenger for the specified address. |
|
| Method Summary | |
|---|---|
void |
closeImpl()
Close connection. |
protected void |
finalize()
The cost of just having a finalize routine is high. |
EndpointAddress |
getLogicalDestinationImpl()
Obtain the logical destination address from the implementer (a transport for example). |
(package private) TransportBindingMeter |
getTransportBindingMeter()
Returns the metering object for this tcpTransport |
boolean |
isClosed()
Returns true if this messenger is closed and no longer
accepting messages to be sent. |
boolean |
isIdleImpl()
return true if this messenger has not been used for a long time. |
List<Message> |
processBuffer()
processes the input byte buffer |
void |
run()
This is what gets run by the Executor. |
void |
sendMessageBImpl(Message message,
String service,
String serviceParam)
Send a message blocking as needed until the message is sent. |
void |
sendMessageDirect(Message message,
String service,
String serviceParam,
boolean direct)
|
| Methods inherited from class net.jxta.impl.endpoint.BlockingMessenger |
|---|
close, getChannelMessenger, getDestAddressToUse, getLogicalDestinationAddress, getState, 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 |
| Methods inherited from class net.jxta.util.AbstractSimpleSelectable |
|---|
getIdentityReference, haveListeners, notifyChange, register, registerListener, unregister, unregisterListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.jxta.util.SimpleSelectable |
|---|
getIdentityReference, register, unregister |
| Field Detail |
|---|
long receiveBeginTime
| Constructor Detail |
|---|
TcpMessenger(SocketChannel socketChannel,
TcpTransport transport)
throws IOException
socketChannel - the SocketChannel for the messengertransport - the tcp MessageSender we are working for.
IOException - if an io error occurs
TcpMessenger(EndpointAddress destaddr,
TcpTransport tcpTransport)
throws IOException
destaddr - the destination of the messengertcpTransport - the tcp MessageSender we are working for.
IOException - if an io error occurs
TcpMessenger(EndpointAddress destaddr,
TcpTransport tcpTransport,
boolean selfDestruct)
throws IOException
destaddr - the destination of the messengertcpTransport - the tcp MessageSender we are working for.selfDestruct - indicates whether the messenger created will self destruct when idle
IOException - if an io error occurs| Method Detail |
|---|
protected void finalize()
throws Throwable
finalize in class ObjectThrowablepublic void closeImpl()
closeImpl in class BlockingMessengerpublic boolean isClosed()
true if this messenger is closed and no longer
accepting messages to be sent. This is a shortcut for
(getState() & USABLE == 0). Once closed, a messenger should be
discarded.
This is a minimal implementation. It may not detect closure
initiated by the other side unless the messenger was actually used
since. A more accurate (but not mandatory implementation) would
actually go and check the underlying connection, if relevant...unless
breakage initiated by the other side is actually reported asynchronously
when it happens. Breakage detection from the other side need not
be reported atomically with its occurrence. This not very important
since we canonicalize transport messengers and so do not need to
aggressively collect closed ones. When not used, messengers die by themselves.
We overload isClosed because many messengers still use super.isClosed()
as part of their own implementation or don't override it at all. They
expect it to be true only when all is shutdown; not while we're closing
gently.
FIXME - [email protected] 20040413: transports should get a deeper retrofit eventually.
isClosed in interface MessengerisClosed in class BlockingMessengertrue if this messenger is closed, otherwise false.public boolean isIdleImpl()
isIdleImpl in class BlockingMessengertrue if theis messenger is, by it's own definition, idle.public EndpointAddress getLogicalDestinationImpl()
getLogicalDestinationImpl in class BlockingMessenger
public void sendMessageBImpl(Message message,
String service,
String serviceParam)
throws IOException
sendMessageBImpl in class BlockingMessengermessage - The message to send.service - The destination service.serviceParam - The destination serivce param.
IOException - Thrown for errors encountered while sending the message.
public void sendMessageDirect(Message message,
String service,
String serviceParam,
boolean direct)
throws IOException
IOExceptionpublic void run()
run in interface Runnablepublic List<Message> processBuffer()
TransportBindingMeter getTransportBindingMeter()
|
JXSE | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||