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
Modifier and Type Method Description boolean
offer(I2CPMessage msg)
Send a message, nonblockingboolean
offer(I2CPMessage msg, long timeout)
Send a message, blocking.I2CPMessage
poll()
Receive a message, nonblockingvoid
put(I2CPMessage msg)
Send a message, blocking until space is availableI2CPMessage
take()
Receive a message, blocking until one is available
-
Constructor Details
-
Method Details
-
offer
Send a message, nonblocking- Specified by:
offer
in classI2CPMessageQueue
- Returns:
- success (false if no space available)
-
offer
Send a message, blocking.- Specified by:
offer
in 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
Receive a message, nonblocking- Specified by:
poll
in classI2CPMessageQueue
- Returns:
- message or null if none available
-
put
Send a message, blocking until space is available- Specified by:
put
in classI2CPMessageQueue
- Throws:
InterruptedException
-
take
Receive a message, blocking until one is available- Specified by:
take
in classI2CPMessageQueue
- Returns:
- message
- Throws:
InterruptedException
-