net.i2p.router.client

## Class I2CPMessageQueueImpl

- java.lang.Object
- - net.i2p.internal.I2CPMessageQueue
  - - net.i2p.router.client.I2CPMessageQueueImpl

-      class I2CPMessageQueueImpl
      extends I2CPMessageQueue

  Contains the methods to talk to a router or client via I2CP, when both are in the same JVM. This interface contains methods to access two queues, one for transmission and one for receiving. The methods are identical to those in java.util.concurrent.BlockingQueue
  Since:
    0.8.3
  Author:
    zzz

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `I2CPMessageQueueImpl(BlockingQueue<I2CPMessage> in, BlockingQueue<I2CPMessage> out)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `offer(I2CPMessage msg)` Send a message, nonblocking
    `I2CPMessage` | `poll()` Receive a message, nonblocking
    `void` | `put(I2CPMessage msg)` Send a message, blocking until space is available
    `I2CPMessage` | `take()` Receive a message, blocking until one is available

    - ### Methods inherited from class net.i2p.internal.I2CPMessageQueue

      `close`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### I2CPMessageQueueImpl

          public I2CPMessageQueueImpl(BlockingQueue<I2CPMessage> in,
                              BlockingQueue<I2CPMessage> out)

  - ### Method Detail

    - #### offer

          public boolean offer(I2CPMessage msg)

      Send a message, nonblocking
      Specified by:
        `offer` in class `I2CPMessageQueue`
      Returns:
        success (false if no space available)

    - #### poll

          public I2CPMessage poll()

      Receive a message, nonblocking
      Specified by:
        `poll` in class `I2CPMessageQueue`
      Returns:
        message or null if none available

    - #### put

          public void put(I2CPMessage msg)
                   throws InterruptedException

      Send a message, blocking until space is available
      Specified by:
        `put` in class `I2CPMessageQueue`
      Throws:
        `InterruptedException`

    - #### take

          public I2CPMessage take()
                           throws InterruptedException

      Receive a message, blocking until one is available
      Specified by:
        `take` in class `I2CPMessageQueue`
      Returns:
        message
      Throws:
        `InterruptedException`