public class ZippingReceivePort<Message> extends java.lang.Object implements ReceivePort<Message>
ReceivePort.EOFException| Constructor and Description |
|---|
ZippingReceivePort(com.google.common.base.Function<java.lang.Object[],Message> f,
java.util.List<? extends ReceivePort<?>> targets) |
ZippingReceivePort(com.google.common.base.Function<java.lang.Object[],Message> f,
ReceivePort<?>... targets) |
ZippingReceivePort(java.util.List<? extends ReceivePort<?>> targets) |
ZippingReceivePort(ReceivePort<?>... targets) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the channel so that no more messages could be sent to it.
|
boolean |
isClosed()
Tests whether the channel has been closed and no more messages await in the channel.
|
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.
|
Message |
receive(Timeout timeout)
Retrieves a message from the channels, possibly blocking until one becomes available, but no longer than the specified timeout.
|
protected Message |
transform(java.lang.Object[] ms) |
Message |
tryReceive()
Retrieves a message from the channel if one is available.
|
public ZippingReceivePort(com.google.common.base.Function<java.lang.Object[],Message> f, ReceivePort<?>... targets)
public ZippingReceivePort(com.google.common.base.Function<java.lang.Object[],Message> f, java.util.List<? extends ReceivePort<?>> targets)
public ZippingReceivePort(ReceivePort<?>... targets)
public ZippingReceivePort(java.util.List<? extends ReceivePort<?>> targets)
public Message receive() throws SuspendExecution, java.lang.InterruptedException
ReceivePortreceive in interface ReceivePort<Message>null if the channel has been closed and no more messages await (see PortAutoCloseable.isClosed()).java.lang.InterruptedExceptionSuspendExecutionpublic Message tryReceive()
ReceivePorttryReceive in interface ReceivePort<Message>null if one is not immediately available.public Message receive(long timeout, java.util.concurrent.TimeUnit unit) throws SuspendExecution, java.lang.InterruptedException
ReceivePortreceive in interface ReceivePort<Message>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.InterruptedExceptionSuspendExecutionpublic Message receive(Timeout timeout) throws SuspendExecution, java.lang.InterruptedException
ReceivePortreceive in interface ReceivePort<Message>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.InterruptedExceptionSuspendExecutionpublic void close()
PortAutoCloseableclose in interface PortAutoCloseableclose in interface java.lang.AutoCloseablepublic boolean isClosed()
PortAutoCloseabletrue all
future calls to receive are guaranteed to return null, and calls to receive on a primitive channel
will throw a EOFException.isClosed in interface PortAutoCloseabletrue if the channels has been closed and no more messages will be received; false otherwise.protected Message transform(java.lang.Object[] ms)