Package net.i2p.router.client
Class I2CPMessageQueueImpl
- java.lang.Object
-
- net.i2p.internal.I2CPMessageQueue
-
- net.i2p.router.client.I2CPMessageQueueImpl
-
- All Implemented Interfaces:
Closeable,AutoCloseable
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 Description I2CPMessageQueueImpl(BlockingQueue<I2CPMessage> in, BlockingQueue<I2CPMessage> out)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanoffer(I2CPMessage msg)Send a message, nonblockingbooleanoffer(I2CPMessage msg, long timeout)Send a message, blocking.I2CPMessagepoll()Receive a message, nonblockingvoidput(I2CPMessage msg)Send a message, blocking until space is availableI2CPMessagetake()Receive a message, blocking until one is available-
Methods inherited from class net.i2p.internal.I2CPMessageQueue
close
-
-
-
-
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:
offerin classI2CPMessageQueue- Returns:
- success (false if no space available)
-
offer
public boolean offer(I2CPMessage msg, long timeout) throws InterruptedException
Send a message, blocking.- Specified by:
offerin classI2CPMessageQueue- Parameters:
timeout- how long to wait for space (ms)- Returns:
- success (false if no space available or if timed out)
- Throws:
InterruptedException- Since:
- 0.9.3
-
poll
public I2CPMessage poll()
Receive a message, nonblocking- Specified by:
pollin classI2CPMessageQueue- 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:
putin classI2CPMessageQueue- Throws:
InterruptedException
-
take
public I2CPMessage take() throws InterruptedException
Receive a message, blocking until one is available- Specified by:
takein classI2CPMessageQueue- Returns:
- message
- Throws:
InterruptedException
-
-