Class OutboundMessageRegistry

  • public class OutboundMessageRegistry
    extends Object
    Tracks outbound messages.
    • Constructor Detail

      • OutboundMessageRegistry

        public OutboundMessageRegistry​(RouterContext context)
    • Method Detail

      • shutdown

        public void shutdown()
        Does something @since 0.8.8
      • restart

        public void restart()
      • 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.
        message - Payload received that may be a reply to something we sent
        non-null List of OutNetMessage describing messages that were waiting for the payload
      • registerPending

        public OutNetMessage registerPending​(MessageSelector replySelector,
                                             ReplyJob onReply,
                                             Job onTimeout)
        Registers a new, empty OutNetMessage, with the reply and timeout jobs specified. The onTimeout job is called at replySelector.getExpiration() (if no reply is received by then)
        replySelector - non-null; The same selector may be used for more than one message.
        onReply - non-null
        onTimeout - may be null
        a dummy OutNetMessage 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.
        msg - msg.getMessage() and msg.getReplySelector() must be non-null
      • unregisterPending

        public void unregisterPending​(OutNetMessage msg)
        msg - may be be null, if non-null should have a non-null selector