Interface ReceivePort<Message>
-
- All Superinterfaces:
java.lang.AutoCloseable,Port<Message>,PortAutoCloseable
- All Known Subinterfaces:
Channel<Message>,DoubleChannel,DoubleReceivePort,FloatChannel,FloatReceivePort,IntChannel,IntReceivePort,LongChannel,LongReceivePort,Mix<M>,StandardChannel<Message>
- All Known Implementing Classes:
Actor,BasicActor,BehaviorActor,DelegatingReceivePort,EventSourceActor,FiniteStateMachineActor,FlatMappingReceivePort,Mailbox,ProxyServerActor,QueueChannel,QueueDoubleChannel,QueueFloatChannel,QueueIntChannel,QueueLongChannel,QueueObjectChannel,QueuePrimitiveChannel,ReceivePortGroup,ServerActor,SingleConsumerQueueChannel,SupervisorActor,TickerChannelConsumer,TickerChannelConsumer.TickerChannelFloatConsumer,TimeoutChannel,TransferChannel,TransformingReceivePort,ValChannel,ZippingReceivePort
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ReceivePort<Message> extends Port<Message>, PortAutoCloseable
A channel's consumer-side functional interface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classReceivePort.EOFException
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Messagereceive()Retrieves a message from the channels, possibly blocking until one becomes available.Messagereceive(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 Messagereceive(Timeout timeout)Retrieves a message from the channels, possibly blocking until one becomes available, but no longer than the specified timeout.default MessagetryReceive()Retrieves a message from the channel if one is available.-
Methods inherited from interface co.paralleluniverse.strands.channels.PortAutoCloseable
close, isClosed
-
-
-
-
Method Detail
-
receive
default Message receive() throws SuspendExecution, java.lang.InterruptedException
Retrieves a message from the channels, possibly blocking until one becomes available.- Returns:
- a message, or
nullif the channel has been closed and no more messages await (seePortAutoCloseable.isClosed()). - Throws:
java.lang.InterruptedExceptionSuspendExecution
-
receive
Message receive(long timeout, java.util.concurrent.TimeUnit unit) throws SuspendExecution, java.lang.InterruptedException
Retrieves a message from the channels, possibly blocking until one becomes available, but no longer than the specified timeout.- Parameters:
timeout- the maximum duration to block waiting for a message.unit- the time unit of the timeout.- Returns:
- a message, or
nullif the channel has been closed and no more messages await (seePortAutoCloseable.isClosed()), or if the timeout has expired. - Throws:
java.lang.InterruptedExceptionSuspendExecution
-
receive
default Message receive(Timeout timeout) throws SuspendExecution, java.lang.InterruptedException
Retrieves a message from the channels, possibly blocking until one becomes available, but no longer than the specified timeout.- Parameters:
timeout- the method will not block for longer than the amount remaining in theTimeout- Returns:
- a message, or
nullif the channel has been closed and no more messages await (seePortAutoCloseable.isClosed()), or if the timeout has expired. - Throws:
java.lang.InterruptedExceptionSuspendExecution
-
tryReceive
default Message tryReceive()
Retrieves a message from the channel if one is available. This method never blocks.- Returns:
- a message, or
nullif one is not immediately available.
-
-