net.i2p.router.transport
Class OutboundMessageRegistry

java.lang.Object
  extended by net.i2p.router.transport.OutboundMessageRegistry

public class OutboundMessageRegistry
extends Object

Tracks outbound messages.


Constructor Summary
OutboundMessageRegistry(RouterContext context)
           
 
Method Summary
 List<OutNetMessage> getOriginalMessages(I2NPMessage message)
          Retrieve all messages that are waiting for the specified message.
 OutNetMessage registerPending(MessageSelector replySelector, ReplyJob onReply, Job onTimeout, int timeoutMs)
          Registers a new, empty OutNetMessage, with the reply and timeout jobs specified.
 void registerPending(OutNetMessage msg)
          Register the message.
 void renderStatusHTML(Writer out)
          Deprecated. unused
 void restart()
           
 void shutdown()
          Does something @since 0.8.8
 void unregisterPending(OutNetMessage msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutboundMessageRegistry

public OutboundMessageRegistry(RouterContext context)
Method Detail

shutdown

public void shutdown()
Does something @since 0.8.8


restart

public void restart()
Since:
0.8.8

getOriginalMessages

public List<OutNetMessage> getOriginalMessages(I2NPMessage message)
Retrieve all messages that are waiting for the specified message. In addition, those matches may include instructions to either continue or not continue waiting for further replies - if it should continue, the matched message remains in the registry, but if it shouldn't continue, the matched message is removed from the registry. This is called only by InNetMessagePool. TODO this calls isMatch() in the selectors from inside the lock, which can lead to deadlocks if the selector does too much in isMatch(). Remove the lock if possible.

Parameters:
message - Payload received that may be a reply to something we sent
Returns:
non-null List of OutNetMessage describing messages that were waiting for the payload

registerPending

public OutNetMessage registerPending(MessageSelector replySelector,
                                     ReplyJob onReply,
                                     Job onTimeout,
                                     int timeoutMs)
Registers a new, empty OutNetMessage, with the reply and timeout jobs specified.

Parameters:
replySelector - non-null; The same selector may be used for more than one message.
onReply - may be null
onTimeout - Also called on failed send; may be null
Returns:
an ONM where getMessage() is null. Use it to call unregisterPending() later if desired.

registerPending

public void registerPending(OutNetMessage msg)
Register the message. Each message must have a non-null selector at msg.getReplySelector(). The same selector may be used for more than one message.

Parameters:
msg - msg.getMessage() and msg.getReplySelector() must be non-null

unregisterPending

public void unregisterPending(OutNetMessage msg)
Parameters:
msg - may be be null

renderStatusHTML

public void renderStatusHTML(Writer out)
                      throws IOException
Deprecated. unused

Throws:
IOException