java.lang.Object
net.i2p.router.tunnel.pool.TestJob.ReplySelector
All Implemented Interfaces:
MessageSelector
Enclosing class:
TestJob

private class TestJob.ReplySelectorextends Object implements MessageSelector
Matches the reply for one test message.
  • Field Details

    • _id

      private final long _id
      The test id the reply must carry.
    • _token

      private final TestJob.RoundToken _token
      The round this reply belongs to.
  • Constructor Details

    • ReplySelector

      public ReplySelector(long id, TestJob.RoundToken token)
      Remembers which message id and round this selector is waiting on.
      Parameters:
      id - the message id being waited on
      token - the round this selector belongs to
  • Method Details

    • continueMatching

      public boolean continueMatching()
      Description copied from interface: MessageSelector
      Returns true if the selector should still keep searching for further matches. This is called only if isMatch() returns true. If this returns true, isMatch() will not be called again.
      Specified by:
      continueMatching in interface MessageSelector
      Returns:
      true to keep searching for further matches, false to stop searching
    • getExpiration

      public long getExpiration()
      Description copied from interface: MessageSelector
      Returns the # of milliseconds since the epoch after which this selector should stop searching for matches. At some time after expiration, if MessageSelector.continueMatching() has not returned false, the job specified by OutNetMessage.getOnFailedReplyJob() will be run for every OutNetMessage associated with this selector (by OutboundMessageRegistry).
      Specified by:
      getExpiration in interface MessageSelector
      Returns:
      the number of milliseconds since the epoch at which to stop searching
    • isMatch

      public boolean isMatch(I2NPMessage m)
      Description copied from interface: MessageSelector
      Returns true if the received message matches the selector. If this returns true, the job specified by OutNetMessage.getOnReplyJob() will be run for every OutNetMessage associated with this selector (by InNetMessagePool), after calling setMessage() for that ReplyJob.

      WARNING this is called from within OutboundMessageSelector.getOriginalMessages() inside a lock and can lead to deadlocks if the selector does too much in MessageSelector.isMatch(I2NPMessage). Until the lock is removed, take care to keep it simple.

      Specified by:
      isMatch in interface MessageSelector
      Parameters:
      m - the received message to test against this selector
      Returns:
      true if the received message is one this selector was waiting for