Interface RBlockingQueueRx<V>

    • Method Detail

      • pollFromAny

        io.reactivex.Flowable<V> pollFromAny​(long timeout,
                                             TimeUnit unit,
                                             String... queueNames)
        Retrieves and removes first available head element of any queue, waiting up to the specified wait time if necessary for an element to become available in any of defined queues including queue own.
        Parameters:
        queueNames - - names of queue
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout parameter
        Returns:
        Flowable object with the head of this queue, or null if the specified waiting time elapses before an element is available
      • drainTo

        io.reactivex.Flowable<Integer> drainTo​(Collection<? super V> c,
                                               int maxElements)
        Removes at most the given number of available elements from this queue and adds them to the given collection in async mode. A failure encountered while attempting to add elements to collection c may result in elements being in neither, either or both collections when the associated exception is thrown. Attempts to drain a queue to itself result in IllegalArgumentException. Further, the behavior of this operation is undefined if the specified collection is modified while the operation is in progress.
        Parameters:
        c - the collection to transfer elements into
        maxElements - the maximum number of elements to transfer
        Returns:
        the number of elements transferred
        Throws:
        UnsupportedOperationException - if addition of elements is not supported by the specified collection
        ClassCastException - if the class of an element of this queue prevents it from being added to the specified collection
        NullPointerException - if the specified collection is null
        IllegalArgumentException - if the specified collection is this queue, or some property of an element of this queue prevents it from being added to the specified collection
      • drainTo

        io.reactivex.Flowable<Integer> drainTo​(Collection<? super V> c)
        Removes all available elements from this queue and adds them to the given collection in async mode. This operation may be more efficient than repeatedly polling this queue. A failure encountered while attempting to add elements to collection c may result in elements being in neither, either or both collections when the associated exception is thrown. Attempts to drain a queue to itself result in IllegalArgumentException. Further, the behavior of this operation is undefined if the specified collection is modified while the operation is in progress.
        Parameters:
        c - the collection to transfer elements into
        Returns:
        the number of elements transferred
        Throws:
        UnsupportedOperationException - if addition of elements is not supported by the specified collection
        ClassCastException - if the class of an element of this queue prevents it from being added to the specified collection
        NullPointerException - if the specified collection is null
        IllegalArgumentException - if the specified collection is this queue, or some property of an element of this queue prevents it from being added to the specified collection
      • pollLastAndOfferFirstTo

        io.reactivex.Flowable<V> pollLastAndOfferFirstTo​(String queueName,
                                                         long timeout,
                                                         TimeUnit unit)
        Retrieves and removes last available tail element of any queue and adds it at the head of queueName, waiting up to the specified wait time if necessary for an element to become available in any of defined queues including queue itself.
        Parameters:
        queueName - - names of destination queue
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout parameter
        Returns:
        the tail of this queue, or null if the specified waiting time elapses before an element is available
      • poll

        io.reactivex.Flowable<V> poll​(long timeout,
                                      TimeUnit unit)
        Retrieves and removes the head of this queue in async mode, waiting up to the specified wait time if necessary for an element to become available.
        Parameters:
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout parameter
        Returns:
        the head of this queue, or null if the specified waiting time elapses before an element is available
      • take

        io.reactivex.Flowable<V> take()
        Retrieves and removes the head of this queue in async mode, waiting if necessary until an element becomes available.
        Returns:
        the head of this queue
      • takeLastAndOfferFirstTo

        io.reactivex.Flowable<V> takeLastAndOfferFirstTo​(String queueName)
        Retrieves and removes last available tail element of any queue and adds it at the head of queueName, waiting if necessary for an element to become available in any of defined queues including queue itself.
        Parameters:
        queueName - - names of destination queue
        Returns:
        the tail of this queue, or null if the specified waiting time elapses before an element is available
      • put

        io.reactivex.Flowable<Void> put​(V e)
        Inserts the specified element into this queue in async mode, waiting if necessary for space to become available.
        Parameters:
        e - the element to add
        Returns:
        void
        Throws:
        ClassCastException - if the class of the specified element prevents it from being added to this queue
        NullPointerException - if the specified element is null
        IllegalArgumentException - if some property of the specified element prevents it from being added to this queue
      • takeElements

        io.reactivex.Flowable<V> takeElements()
        Retrieves and removes continues stream of elements from the head of this queue. Waits for next element become available.
        Returns:
        stream of elements