Interface ReceivePort<Message>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method 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.
    • 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 null if the channel has been closed and no more messages await (see PortAutoCloseable.isClosed()).
        Throws:
        java.lang.InterruptedException
        SuspendExecution
      • 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 null if the channel has been closed and no more messages await (see PortAutoCloseable.isClosed()), or if the timeout has expired.
        Throws:
        java.lang.InterruptedException
        SuspendExecution
      • 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 the Timeout
        Returns:
        a message, or null if the channel has been closed and no more messages await (see PortAutoCloseable.isClosed()), or if the timeout has expired.
        Throws:
        java.lang.InterruptedException
        SuspendExecution
      • tryReceive

        default Message tryReceive()
        Retrieves a message from the channel if one is available. This method never blocks.
        Returns:
        a message, or null if one is not immediately available.