@FunctionalInterface public interface SendPort<Message> extends Port<Message>, PortAutoCloseable
| Modifier and Type | Method and Description |
|---|---|
default void |
close(java.lang.Throwable t)
Closes the channel so that no more messages could be sent to it, and signifies an exception occurred in the producer.
|
default void |
send(Message message)
Sends a message to the channel, possibly blocking until there's room available in the channel.
|
boolean |
send(Message message,
long timeout,
java.util.concurrent.TimeUnit unit)
Sends a message to the channel, possibly blocking until there's room available in the channel, but never longer than the
specified timeout.
|
default boolean |
send(Message message,
Timeout timeout)
Sends a message to the channel, possibly blocking until there's room available in the channel, but never longer than the
specified timeout.
|
default boolean |
trySend(Message message)
Sends a message to the channel if the channel has room available.
|
close, isCloseddefault void send(Message message) throws SuspendExecution, java.lang.InterruptedException
OverflowPolicy, set at construction time.message - java.lang.InterruptedExceptionSuspendExecutionboolean send(Message message, long timeout, java.util.concurrent.TimeUnit unit) throws SuspendExecution, java.lang.InterruptedException
OverflowPolicy, set at construction time.message - timeout - the maximum duration this method is allowed to wait.unit - the timeout's time unittrue if the message has been sent successfully; false if the timeout has expired.SuspendExecutionjava.lang.InterruptedExceptiondefault boolean send(Message message, Timeout timeout) throws SuspendExecution, java.lang.InterruptedException
OverflowPolicy, set at construction time.message - timeout - the method will not block for longer than the amount remaining in the Timeouttrue if the message has been sent successfully; false if the timeout has expired.SuspendExecutionjava.lang.InterruptedExceptiondefault boolean trySend(Message message)
message - true if the message has been sent; false otherwise.default void close(java.lang.Throwable t)
ReceivePort's receive or tryReceive,
wrapped by a ProducerException.
Messages already sent to the channel prior to calling this method will still be received.