com.hazelcast.core

## Interface TransactionalQueue<E>

- Type Parameters:
    `E` - the type of elements held in this collection
  All Superinterfaces:
    BaseQueue<E>, DistributedObject, TransactionalObject
  All Known Implementing Classes:
    ClientTxnQueueProxy

      public interface TransactionalQueue<E>
      extends TransactionalObject, BaseQueue<E>

  Transactional implementation of `BaseQueue`.
  See Also:
    `BaseQueue`, `IQueue`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `offer(E e)` Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions.
    `boolean` | `offer(E e, long timeout, TimeUnit unit)` Inserts the specified element into this queue, waiting up to the specified wait time if necessary for space to become available.
    `E` | `peek()`
    `E` | `peek(long timeout, TimeUnit unit)`
    `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.
    `int` | `size()` Returns the number of elements in this collection.
    `E` | `take()` Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.

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

      `destroy, getName, getPartitionKey, getServiceName`

- - ### Method Detail

    - #### offer

          boolean offer(E e)

      Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions. Returns `true` upon success and `false` if no space is currently available.
      Specified by:
        `offer` in interface `BaseQueue<E>`
      Parameters:
        `e` - the element to add
      Returns:
        `true` if the element was added to this queue, `false` otherwise

    - #### offer

          boolean offer(E e,
                        long timeout,
                        TimeUnit unit)
                 throws InterruptedException

      Inserts the specified element into this queue, waiting up to the specified wait time if necessary for space to become available.
      Specified by:
        `offer` in interface `BaseQueue<E>`
      Parameters:
        `e` - the element to add
        `timeout` - how long to wait before giving up, in units of `unit`
        `unit` - a `TimeUnit` determines how to interpret the `timeout` parameter
      Returns:
        `true` if successful, or `false` if the specified waiting time elapses before space 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>`
      Returns:
        the head of this queue
      Throws:
        `InterruptedException` - if interrupted while waiting

    - #### 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>`
      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>`
      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

    - #### peek

          E peek()

    - #### peek

          E peek(long timeout,
                 TimeUnit unit)
          throws InterruptedException

      Throws:
        `InterruptedException`

    - #### size

          int size()

      Returns the number of elements in this collection. If this collection contains more than `Integer.MAX_VALUE` elements, returns `Integer.MAX_VALUE`.
      Specified by:
        `size` in interface `BaseQueue<E>`
      Returns:
        the number of elements in this collection

Copyright © 2020. All rights reserved.