Interface RBlockingQueue<V>

    • Method Detail

      • pollFromAny

        V pollFromAny​(long timeout,
                      TimeUnit unit,
                      String... queueNames)
               throws InterruptedException
        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 itself.
        Parameters:
        queueNames - - queue names. Queue name itself is always included
        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
        Throws:
        InterruptedException - if interrupted while waiting
      • pollLastAndOfferFirstTo

        V pollLastAndOfferFirstTo​(String queueName,
                                  long timeout,
                                  TimeUnit unit)
                           throws InterruptedException
        Retrieves and removes last available tail element of this queue and adds it at the head of queueName, waiting up to the specified wait time if necessary for an element to become available.
        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
        Throws:
        InterruptedException - if interrupted while waiting
      • takeLastAndOfferFirstTo

        V takeLastAndOfferFirstTo​(String queueName)
                           throws InterruptedException
        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
        Throws:
        InterruptedException - if interrupted while waiting
      • subscribeOnElements

        int subscribeOnElements​(Consumer<V> consumer)
        Subscribes on elements appeared in this queue. Continuously invokes RBlockingQueueAsync.takeAsync() method to get a new element.
        Parameters:
        consumer - - queue elements listener
        Returns:
        listenerId - id of listener
      • unsubscribe

        void unsubscribe​(int listenerId)
        Un-subscribes defined listener.
        Parameters:
        listenerId - - id of listener