com.hazelcast.core

## Interface IQueue<E>

- Type Parameters:
    `E` - queue item type
  All Superinterfaces:
    BaseQueue<E>, BlockingQueue<E>, Collection<E>, DistributedObject, ICollection<E>, Iterable<E>, Queue<E>
  All Known Implementing Classes:
    ClientQueueProxy

      public interface IQueue<E>
      extends BlockingQueue<E>, BaseQueue<E>, ICollection<E>

  Concurrent, blocking, distributed, observable queue.

  The IQueue is not a partitioned data-structure. All the content of an IQueue is stored in a single machine (and in the backup). The IQueue will not scale by adding more members to the cluster.

  See Also:
    `BaseQueue`, `Queue`, `BlockingQueue`, `TransactionalQueue`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `LocalQueueStats` | `getLocalQueueStats()` Returns LocalQueueStats for this queue.
    `E` | `poll()` Retrieves and removes the head of this queue, or returns `null` if this queue is empty.
    `E` | `poll(long timeout, TimeUnit unit)` Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available.
    `E` | `take()` Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.

    - ### Methods inherited from interface java.util.concurrent.BlockingQueue

      `add, contains, drainTo, drainTo, offer, offer, put, remainingCapacity, remove`

    - ### Methods inherited from interface java.util.Queue

      `element, peek, remove`

    - ### Methods inherited from interface java.util.Collection

      `addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach`

    - ### Methods inherited from interface com.hazelcast.core.BaseQueue

      `offer, offer, size`

    - ### Methods inherited from interface com.hazelcast.core.ICollection

      `addItemListener, getName, removeItemListener`

    - ### Methods inherited from interface com.hazelcast.core.DistributedObject

      `destroy, getPartitionKey, getServiceName`

- - ### Method Detail

    - #### poll

          E poll()

      Retrieves and removes the head of this queue, or returns `null` if this queue is empty.
      Specified by:
        `poll` in interface `BaseQueue<E>`
      Specified by:
        `poll` in interface `Queue<E>`
      Returns:
        the head of this queue, or `null` if this queue is empty

    - #### poll

          E poll(long timeout,
                 TimeUnit unit)
          throws InterruptedException

      Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available.
      Specified by:
        `poll` in interface `BaseQueue<E>`
      Specified by:
        `poll` in interface `BlockingQueue<E>`
      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
      Throws:
        `InterruptedException` - if interrupted while waiting

    - #### take

          E take()
          throws InterruptedException

      Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.
      Specified by:
        `take` in interface `BaseQueue<E>`
      Specified by:
        `take` in interface `BlockingQueue<E>`
      Returns:
        the head of this queue
      Throws:
        `InterruptedException` - if interrupted while waiting

    - #### getLocalQueueStats

          LocalQueueStats getLocalQueueStats()

      Returns LocalQueueStats for this queue. LocalQueueStats is the statistics for the local portion of this queue.
      Returns:
        this queue's local statistics.

Copyright © 2019. All rights reserved.