|
Project 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
This class is a near-drop-in replacement for the previous BlockingMessenger class. To subclassers (that is, currently, transports) the only difference is that some overloaded methods have a different name (class hierarchy reasons made it impossible to preserve the names without forcing an API change for applications). The other difference which is not API visible, is that it implements the standard MessengerState behaviour and semantics required by the changes in the endpoint framework. This the only base messenger class meant to be extended by outside code that is in the impl tree. The reason being that what it replaces was there already and that new code should not become dependant upon it.
Nested Class Summary |
Nested classes inherited from class net.jxta.util.SimpleSelectable |
SimpleSelectable.IdentityReference |
Field Summary |
Fields inherited from class net.jxta.endpoint.AbstractMessenger |
DEFAULT_MTU, dstAddress |
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 | |
BlockingMessenger(PeerGroupID homeGroupID,
EndpointAddress dest,
boolean selfDestruct)
Constructor. |
Method Summary | |
void |
close()
Some transports historically overload the close method of BlockingMessenger. |
protected abstract void |
closeImpl()
Close connection. |
Messenger |
getChannelMessenger(PeerGroupID redirection,
String service,
String serviceParam)
|
protected EndpointAddress |
getDestAddressToUse(String service,
String serviceParam)
A trivial convenience method that transports still depend upon. |
EndpointAddress |
getLogicalDestinationAddress()
getLogicalDestinationAddress() requires resolution (it's the address advertised by the other end). |
protected abstract EndpointAddress |
getLogicalDestinationImpl()
Obtain the logical destination address from the implementer (a transport for example). |
int |
getState()
|
boolean |
isClosed()
We overload isClosed because many messengers still invoke super.isClosed() for their own implementation and they expect it to be true only when all is shutdown; not while we're closing gently. |
protected abstract boolean |
isIdleImpl()
return true if this messenger has not been used for a long time. |
void |
resolve()
|
void |
sendMessageB(Message msg,
String service,
String serviceParam)
|
protected abstract boolean |
sendMessageBImpl(Message message,
String service,
String param)
send message. block as needed. throw IOException or runtime exception as needed. |
boolean |
sendMessageN(Message msg,
String service,
String serviceParam)
|
void |
setOwner(Object owner)
Sets an owner for this blocking messenger. |
protected void |
shutdown()
A transport may call this to cause an orderly closure of its messengers. |
Methods inherited from class net.jxta.endpoint.AbstractMessenger |
flush, getDestinationAddress, getDestinationAddressObject, getMTU, isIdle, isSynchronous, itemChanged, sendMessage, sendMessage, sendMessage, setStateLock, 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, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.jxta.util.SimpleSelectable |
getIdentityReference, register, unregister |
Constructor Detail |
public BlockingMessenger(PeerGroupID homeGroupID, EndpointAddress dest, boolean selfDestruct)
homeGroupID
- the group that this messenger works for. This is the group of the endpoint service or transport
that created this messenger.dest
- where messages should be addressed toselfDestruct
- true if this messenger must self close destruct when idle. Warning: If selfDestruct is used,
this messenger will remained referenced for as long as isIdleImpl returns false.Method Detail |
public void setOwner(Object owner)
owner
- The object that should be kept referenced at least as long as this one.protected EndpointAddress getDestAddressToUse(String service, String serviceParam)
protected final void shutdown()
public boolean isClosed()
public final EndpointAddress getLogicalDestinationAddress()
public final void close()
public void sendMessageB(Message msg, String service, String serviceParam) throws IOException
IOException
public final boolean sendMessageN(Message msg, String service, String serviceParam)
public final void resolve()
public final int getState()
public final Messenger getChannelMessenger(PeerGroupID redirection, String service, String serviceParam)
protected abstract void closeImpl()
protected abstract boolean sendMessageBImpl(Message message, String service, String param) throws IOException
IOException
protected abstract boolean isIdleImpl()
protected abstract EndpointAddress getLogicalDestinationImpl()
|
JXTA J2SE | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |