@FunctionalInterface public interface ReceivePort<Message> extends Port<Message>, PortAutoCloseable
| Modifier and Type | Interface and Description |
|---|---|
static class |
ReceivePort.EOFException |
| Modifier and Type | Method and Description |
|---|---|
default Message |
receive()
Retrieves a message from the channels, possibly blocking until one becomes available.
|
Message |
receive(long timeout,
java.util.concurrent.TimeUnit unit)
Retrieves a message from the channels, possibly blocking until one becomes available, but no longer than the specified timeout.
|
default Message |
receive(Timeout timeout)
Retrieves a message from the channels, possibly blocking until one becomes available, but no longer than the specified timeout.
|
default Message |
tryReceive()
Retrieves a message from the channel if one is available.
|
close, isCloseddefault Message receive() throws SuspendExecution, java.lang.InterruptedException
null if the channel has been closed and no more messages await (see PortAutoCloseable.isClosed()).java.lang.InterruptedExceptionSuspendExecutionMessage receive(long timeout, java.util.concurrent.TimeUnit unit) throws SuspendExecution, java.lang.InterruptedException
timeout - the maximum duration to block waiting for a message.unit - the time unit of the timeout.null if the channel has been closed and no more messages await (see PortAutoCloseable.isClosed()), or if the timeout has expired.java.lang.InterruptedExceptionSuspendExecutiondefault Message receive(Timeout timeout) throws SuspendExecution, java.lang.InterruptedException
timeout - the method will not block for longer than the amount remaining in the Timeoutnull if the channel has been closed and no more messages await (see PortAutoCloseable.isClosed()), or if the timeout has expired.java.lang.InterruptedExceptionSuspendExecutiondefault Message tryReceive()
null if one is not immediately available.