Class QueueDoubleChannel

    • Constructor Detail

      • QueueDoubleChannel

        public QueueDoubleChannel​(co.paralleluniverse.strands.queues.BasicSingleConsumerDoubleQueue queue,
                                  Channels.OverflowPolicy policy)
    • Method Detail

      • receiveDouble

        public double receiveDouble​(long timeout,
                                    java.util.concurrent.TimeUnit unit)
                             throws SuspendExecution,
                                    java.lang.InterruptedException,
                                    java.util.concurrent.TimeoutException,
                                    ReceivePort.EOFException
        Description copied from interface: DoubleReceivePort
        Retrieves a message from the channels, possibly blocking until one becomes available, but no longer than the specified timeout. If the channel has been closed and no more messages await, this method throws an ReceivePort.EOFException.
        Specified by:
        receiveDouble in interface DoubleReceivePort
        Parameters:
        timeout - the maximum duration to block waiting for a message.
        unit - the time unit of the timeout.
        Returns:
        a message. (see PortAutoCloseable.isClosed()), or if the timeout has expired.
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.TimeoutException - if the timeout has expired
        ReceivePort.EOFException - if the channel has been closed and no more messages await
        SuspendExecution
      • trySend

        public boolean trySend​(double message)
        Description copied from interface: DoubleSendPort
        Sends a message to the channel if the channel has room available. This method never blocks.
        Specified by:
        trySend in interface DoubleSendPort
        Returns:
        true if the message has been sent; false otherwise.
      • send

        public void send​(double message)
                  throws SuspendExecution,
                         java.lang.InterruptedException
        Description copied from interface: DoubleSendPort
        Sends a message to the channel, possibly blocking until there's room available in the channel. If the channel is full, this method may block, throw an exception, silently drop the message, or displace an old message from the channel. The behavior is determined by the channel's OverflowPolicy, set at construction time.
        Specified by:
        send in interface DoubleSendPort
        Throws:
        SuspendExecution
        java.lang.InterruptedException
      • send

        public boolean send​(double message,
                            long timeout,
                            java.util.concurrent.TimeUnit unit)
                     throws SuspendExecution,
                            java.lang.InterruptedException
        Description copied from interface: DoubleSendPort
        Sends a message to the channel, possibly blocking until there's room available in the channel, but never longer than the specified timeout. If the channel is full, this method may block, throw an exception, silently drop the message, or displace an old message from the channel. The behavior is determined by the channel's OverflowPolicy, set at construction time.
        Specified by:
        send in interface DoubleSendPort
        timeout - the maximum duration this method is allowed to wait.
        unit - the timeout's time unit
        Returns:
        true if the message has been sent successfully; false if the timeout has expired.
        Throws:
        SuspendExecution
        java.lang.InterruptedException
      • send

        public boolean send​(double message,
                            Timeout timeout)
                     throws SuspendExecution,
                            java.lang.InterruptedException
        Description copied from interface: DoubleSendPort
        Sends a message to the channel, possibly blocking until there's room available in the channel, but never longer than the specified timeout. If the channel is full, this method may block, throw an exception, silently drop the message, or displace an old message from the channel. The behavior is determined by the channel's OverflowPolicy, set at construction time.
        Specified by:
        send in interface DoubleSendPort
        timeout - the method will not block for longer than the amount remaining in the Timeout
        Returns:
        true if the message has been sent successfully; false if the timeout has expired.
        Throws:
        SuspendExecution
        java.lang.InterruptedException
      • queue

        protected co.paralleluniverse.strands.queues.BasicSingleConsumerDoubleQueue queue()
        Overrides:
        queue in class QueuePrimitiveChannel<java.lang.Double>