org.apache.solr.cloud

Class DistributedQueue

    • Method Detail

      • peek

        public byte[] peek()
                    throws KeeperException,
                           InterruptedException
        Returns the data at the first element of the queue, or null if the queue is empty.
        Returns:
        data at the first element of the queue, or null.
        Throws:
        KeeperException
        InterruptedException
      • peek

        public byte[] peek(boolean block)
                    throws KeeperException,
                           InterruptedException
        Returns the data at the first element of the queue, or null if the queue is empty and block is false.
        Parameters:
        block - if true, blocks until an element enters the queue
        Returns:
        data at the first element of the queue, or null.
        Throws:
        KeeperException
        InterruptedException
      • peek

        public byte[] peek(long wait)
                    throws KeeperException,
                           InterruptedException
        Returns the data at the first element of the queue, or null if the queue is empty after wait ms.
        Parameters:
        wait - max wait time in ms.
        Returns:
        data at the first element of the queue, or null.
        Throws:
        KeeperException
        InterruptedException
      • poll

        public byte[] poll()
                    throws KeeperException,
                           InterruptedException
        Attempts to remove the head of the queue and return it. Returns null if the queue is empty.
        Returns:
        Head of the queue or null.
        Throws:
        KeeperException
        InterruptedException
      • take

        public byte[] take()
                    throws KeeperException,
                           InterruptedException
        Removes the head of the queue and returns it, blocks until it succeeds.
        Returns:
        The former head of the queue
        Throws:
        KeeperException
        InterruptedException
      • offer

        public void offer(byte[] data)
                   throws KeeperException,
                          InterruptedException
        Inserts data into queue. Successfully calling this method does NOT guarantee that the element will be immediately available in the in-memory queue. In particular, calling this method on an empty queue will not necessarily cause poll() to return the offered element. Use a blocking method if you must wait for the offered element to become visible.
        Throws:
        KeeperException
        InterruptedException