org.apache.ignite.internal.processors.datastructures

## Class GridCacheQueueProxy<T>

- java.lang.Object
- - org.apache.ignite.internal.processors.datastructures.GridCacheQueueProxy<T>

All Implemented Interfaces:
  Closeable, Externalizable, Serializable, AutoCloseable, Iterable<T>, Collection<T>, BlockingQueue<T>, Queue<T>, IgniteQueue<T>

    public class GridCacheQueueProxy<T>
    extends Object
    implements IgniteQueue<T>, Externalizable

Cache queue proxy.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`GridCacheQueueProxy()` Required by `Externalizable`.
`GridCacheQueueProxy(GridCacheContext cctx, GridCacheQueueAdapter<T> delegate)`

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `add(T item)`
`boolean` `addAll(Collection<? extends T> items)`
`<R> R` `affinityCall(IgniteCallable<R> job)` Executes given job on collocated queue on the node where the queue is located (a.k.a. affinity co-location).
`void` `affinityRun(IgniteRunnable job)` Executes given job on collocated queue on the node where the queue is located (a.k.a. affinity co-location).
`boolean` `bounded()` Returns `true` if this queue is bounded.
`int` `capacity()` Gets maximum number of elements of the queue.
`void` `clear()`
`void` `clear(int batchSize)` Removes all of the elements from this queue.
`void` `close()` Removes this queue.
`boolean` `collocated()` Returns `true` if this queue can be kept on the one node only.
`boolean` `contains(Object item)`
`boolean` `containsAll(Collection<?> items)`
`GridCacheQueueAdapter<T>` `delegate()`
`int` `drainTo(Collection<? super T> c)`
`int` `drainTo(Collection<? super T> c, int maxElements)`
`T` `element()`
`boolean` `equals(Object o)`
`int` `hashCode()`
`boolean` `isEmpty()`
`Iterator<T>` `iterator()`
`String` `name()` Gets queue name.
`boolean` `offer(T item)`
`boolean` `offer(T item, long timeout, TimeUnit unit)`
`T` `peek()`
`T` `poll()`
`T` `poll(long timeout, TimeUnit unit)`
`void` `put(T item)`
`void` `readExternal(ObjectInput in)`
`protected Object` `readResolve()` Reconstructs object on unmarshalling.
`int` `remainingCapacity()`
`T` `remove()`
`boolean` `remove(Object item)`
`boolean` `removeAll(Collection<?> items)`
`boolean` `removed()` Gets status of queue.
`boolean` `retainAll(Collection<?> items)`
`int` `size()`
`T` `take()`
`Object[]` `toArray()`
`<T1> T1[]` `toArray(T1[] a)`
`String` `toString()`
`void` `writeExternal(ObjectOutput out)`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

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

`parallelStream, removeIf, spliterator, stream`

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

`forEach`

### Constructor Detail

#### GridCacheQueueProxy

    public GridCacheQueueProxy()

Required by `Externalizable`.

#### GridCacheQueueProxy

    public GridCacheQueueProxy(GridCacheContext cctx,
                               GridCacheQueueAdapter<T> delegate)

Parameters:
  `cctx` - Cache context.
  `delegate` - Delegate queue.

### Method Detail

#### delegate

    public GridCacheQueueAdapter<T> delegate()

Returns:
  Delegate queue.

#### add

    public boolean add(T item)

Specified by:
  `add` in interface `Collection<T>`
Specified by:
  `add` in interface `BlockingQueue<T>`
Specified by:
  `add` in interface `Queue<T>`
Specified by:
  `add` in interface `IgniteQueue<T>`

#### offer

    public boolean offer(T item)

Specified by:
  `offer` in interface `BlockingQueue<T>`
Specified by:
  `offer` in interface `Queue<T>`
Specified by:
  `offer` in interface `IgniteQueue<T>`

#### addAll

    public boolean addAll(Collection<? extends T> items)

Specified by:
  `addAll` in interface `Collection<T>`
Specified by:
  `addAll` in interface `IgniteQueue<T>`

#### contains

    public boolean contains(Object item)

Specified by:
  `contains` in interface `Collection<T>`
Specified by:
  `contains` in interface `BlockingQueue<T>`
Specified by:
  `contains` in interface `IgniteQueue<T>`

#### containsAll

    public boolean containsAll(Collection<?> items)

Specified by:
  `containsAll` in interface `Collection<T>`
Specified by:
  `containsAll` in interface `IgniteQueue<T>`

#### clear

    public void clear()

Specified by:
  `clear` in interface `Collection<T>`
Specified by:
  `clear` in interface `IgniteQueue<T>`

#### remove

    public boolean remove(Object item)

Specified by:
  `remove` in interface `Collection<T>`
Specified by:
  `remove` in interface `BlockingQueue<T>`
Specified by:
  `remove` in interface `IgniteQueue<T>`

#### removeAll

    public boolean removeAll(Collection<?> items)

Specified by:
  `removeAll` in interface `Collection<T>`
Specified by:
  `removeAll` in interface `IgniteQueue<T>`

#### isEmpty

    public boolean isEmpty()

Specified by:
  `isEmpty` in interface `Collection<T>`
Specified by:
  `isEmpty` in interface `IgniteQueue<T>`

#### iterator

    public Iterator<T> iterator()

Specified by:
  `iterator` in interface `Iterable<T>`
Specified by:
  `iterator` in interface `Collection<T>`
Specified by:
  `iterator` in interface `IgniteQueue<T>`

#### toArray

    public Object[] toArray()

Specified by:
  `toArray` in interface `Collection<T>`
Specified by:
  `toArray` in interface `IgniteQueue<T>`

#### toArray

    public <T1> T1[] toArray(T1[] a)

Specified by:
  `toArray` in interface `Collection<T>`
Specified by:
  `toArray` in interface `IgniteQueue<T>`

#### retainAll

    public boolean retainAll(Collection<?> items)

Specified by:
  `retainAll` in interface `Collection<T>`
Specified by:
  `retainAll` in interface `IgniteQueue<T>`

#### size

    public int size()

Specified by:
  `size` in interface `Collection<T>`
Specified by:
  `size` in interface `IgniteQueue<T>`

#### poll

    @Nullable
    public T poll()

Specified by:
  `poll` in interface `Queue<T>`
Specified by:
  `poll` in interface `IgniteQueue<T>`

#### peek

    @Nullable
    public T peek()

Specified by:
  `peek` in interface `Queue<T>`
Specified by:
  `peek` in interface `IgniteQueue<T>`

#### clear

    public void clear(int batchSize)

Removes all of the elements from this queue. Method is used in massive queues with huge numbers of elements.

Specified by:
  `clear` in interface `IgniteQueue<T>`
Parameters:
  `batchSize` - Batch size.

#### remainingCapacity

    public int remainingCapacity()

Specified by:
  `remainingCapacity` in interface `BlockingQueue<T>`

#### drainTo

    public int drainTo(Collection<? super T> c)

Specified by:
  `drainTo` in interface `BlockingQueue<T>`

#### drainTo

    public int drainTo(Collection<? super T> c,
                       int maxElements)

Specified by:
  `drainTo` in interface `BlockingQueue<T>`

#### remove

    public T remove()

Specified by:
  `remove` in interface `Queue<T>`

#### element

    public T element()

Specified by:
  `element` in interface `Queue<T>`

#### put

    public void put(T item)

Specified by:
  `put` in interface `BlockingQueue<T>`
Specified by:
  `put` in interface `IgniteQueue<T>`

#### offer

    public boolean offer(T item,
                         long timeout,
                         TimeUnit unit)

Specified by:
  `offer` in interface `BlockingQueue<T>`
Specified by:
  `offer` in interface `IgniteQueue<T>`

#### take

    @Nullable
    public T take()

Specified by:
  `take` in interface `BlockingQueue<T>`
Specified by:
  `take` in interface `IgniteQueue<T>`

#### poll

    @Nullable
    public T poll(long timeout,
                            TimeUnit unit)

Specified by:
  `poll` in interface `BlockingQueue<T>`
Specified by:
  `poll` in interface `IgniteQueue<T>`

#### close

    public void close()

Removes this queue.

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `IgniteQueue<T>`

#### name

    public String name()

Gets queue name.

Specified by:
  `name` in interface `IgniteQueue<T>`
Returns:
  Queue name.

#### capacity

    public int capacity()

Gets maximum number of elements of the queue.

Specified by:
  `capacity` in interface `IgniteQueue<T>`
Returns:
  Maximum number of elements. If queue is unbounded `Integer.MAX_SIZE` will return.

#### bounded

    public boolean bounded()

Returns `true` if this queue is bounded.

Specified by:
  `bounded` in interface `IgniteQueue<T>`
Returns:
  `true` if this queue is bounded.

#### collocated

    public boolean collocated()

Returns `true` if this queue can be kept on the one node only. Returns `false` if this queue can be kept on the many nodes.

Specified by:
  `collocated` in interface `IgniteQueue<T>`
Returns:
  `true` if this queue is in `collocated` mode `false` otherwise.

#### removed

    public boolean removed()

Gets status of queue.

Specified by:
  `removed` in interface `IgniteQueue<T>`
Returns:
  `true` if queue was removed from cache `false` otherwise.

#### affinityRun

    public void affinityRun(IgniteRunnable job)

Executes given job on collocated queue on the node where the queue is located (a.k.a. affinity co-location).

This is not supported for non-collocated queues.

Specified by:
  `affinityRun` in interface `IgniteQueue<T>`
Parameters:
  `job` - Job which will be co-located with the queue.

#### affinityCall

    public <R> R affinityCall(IgniteCallable<R> job)

Executes given job on collocated queue on the node where the queue is located (a.k.a. affinity co-location).

This is not supported for non-collocated queues.

Specified by:
  `affinityCall` in interface `IgniteQueue<T>`
Parameters:
  `job` - Job which will be co-located with the queue.

#### hashCode

    public int hashCode()

Specified by:
  `hashCode` in interface `Collection<T>`
Overrides:
  `hashCode` in class `Object`

#### equals

    public boolean equals(Object o)

Specified by:
  `equals` in interface `Collection<T>`
Overrides:
  `equals` in class `Object`

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

#### readResolve

    protected Object readResolve()
                          throws ObjectStreamException

Reconstructs object on unmarshalling.

Returns:
  Reconstructed object.
Throws:
  `ObjectStreamException` - Thrown in case of unmarshalling error.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.6
Release Date | : September 11 2019