java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.client.MessageReceivedJob
All Implemented Interfaces:
Job

class MessageReceivedJobextends JobImpl
Async job to notify the client that a new message is available for them, or just send it directly if specified.
  • Field Details

    • _log

      private final Log _log
      Logger for this class.
    • _runner

      private final ClientConnectionRunner _runner
      The runner delivering the message.
    • _toDest

      private final Destination _toDest
      The destination the message is addressed to.
    • _payload

      private final Payload _payload
      The message being delivered.
    • _sendDirect

      private final boolean _sendDirect
      True if the message arrived directly, not through a tunnel.
  • Constructor Details

    • MessageReceivedJob

      public MessageReceivedJob(RouterContext ctx, ClientConnectionRunner runner, Destination toDest, Destination fromDest, Payload payload, boolean sendDirect)
      Create a job that delivers one received message to a client.
      Parameters:
      ctx - the router context
      runner - the client connection runner
      toDest - non-null, required to pick session
      fromDest - sending destination, generally null
      payload - the message payload
      sendDirect - if true send directly
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Job
      Descriptive name of the task.
      Returns:
      the descriptive name of the task
    • runJob

      public void runJob()
      Description copied from interface: Job
      Actually perform the task. This call blocks until the Job is complete.
    • receiveMessage

      public boolean receiveMessage()
      Same as runJob() but with a return value.
      Returns:
      true if the payload was handed over, false if the runner is dead or the send threw
    • messageAvailable

      private void messageAvailable(MessageId id, long size) throws I2CPMessageException
      Deliver notification to the client that the given message is available.
      Parameters:
      id - the id of the message that became available
      size - the message size in bytes
      Throws:
      I2CPMessageException - if the status message cannot be sent to the client
    • sendMessage

      private void sendMessage(long id) throws I2CPMessageException
      Deliver the message directly, skip notification.
      Parameters:
      id - the id of the queued message to deliver
      Throws:
      I2CPMessageException - if the payload message cannot be sent to the client