com.hazelcast.core
Interface IQueue<E>

Type Parameters:
E -
All Superinterfaces:
BaseQueue<E>, BlockingQueue<E>, Collection<E>, DistributedObject, ICollection<E>, Iterable<E>, Queue<E>

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

Concurrent, blocking, distributed, observable queue.

See Also:
BaseQueue, Queue, BlockingQueue, TransactionalQueue

Method Summary
 boolean add(E e)
          
 boolean addAll(Collection<? extends E> c)
          
 void clear()
          
 boolean contains(Object o)
          
 boolean containsAll(Collection<?> c)
          
 int drainTo(Collection<? super E> c)
          
 int drainTo(Collection<? super E> c, int maxElements)
          
 E element()
          
 LocalQueueStats getLocalQueueStats()
          Returns LocalQueueStats for this queue.
 boolean isEmpty()
          
 Iterator<E> iterator()
          
 boolean offer(E e)
          Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions, returning true upon success and false if no space is currently available.
 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 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.
 void put(E e)
          
 int remainingCapacity()
          
 E remove()
          
 boolean remove(Object o)
          
 boolean removeAll(Collection<?> c)
          
 boolean retainAll(Collection<?> c)
          
 int size()
          Returns the number of elements in this collection.
 E take()
          
 Object[] toArray()
          
<T> T[]
toArray(T[] a)
          
 
Methods inherited from interface java.util.Collection
equals, hashCode
 
Methods inherited from interface com.hazelcast.core.ICollection
addItemListener, getName, removeItemListener
 
Methods inherited from interface com.hazelcast.core.DistributedObject
destroy, getId, getPartitionKey, getServiceName
 

Method Detail

add

boolean add(E e)

Specified by:
add in interface BlockingQueue<E>
Specified by:
add in interface Collection<E>
Specified by:
add in interface Queue<E>

offer

boolean offer(E e)
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions, returning true upon success and false if no space is currently available.

Specified by:
offer in interface BaseQueue<E>
Specified by:
offer in interface BlockingQueue<E>
Specified by:
offer in interface Queue<E>
Parameters:
e - the element to add
Returns:
true if the element was added to this queue, else false

put

void put(E e)
         throws InterruptedException

Specified by:
put in interface BlockingQueue<E>
Throws:
InterruptedException

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>
Specified by:
offer in interface BlockingQueue<E>
Parameters:
e - the element to add
timeout - how long to wait before giving up, in units of unit
unit - a TimeUnit determining 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

Specified by:
take in interface BlockingQueue<E>
Throws:
InterruptedException

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

remainingCapacity

int remainingCapacity()

Specified by:
remainingCapacity in interface BlockingQueue<E>

remove

boolean remove(Object o)

Specified by:
remove in interface BlockingQueue<E>
Specified by:
remove in interface Collection<E>

contains

boolean contains(Object o)

Specified by:
contains in interface BlockingQueue<E>
Specified by:
contains in interface Collection<E>

drainTo

int drainTo(Collection<? super E> c)

Specified by:
drainTo in interface BlockingQueue<E>

drainTo

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

Specified by:
drainTo in interface BlockingQueue<E>

remove

E remove()

Specified by:
remove in interface Queue<E>

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

element

E element()

Specified by:
element in interface Queue<E>

peek

E peek()

Specified by:
peek in interface Queue<E>

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>
Specified by:
size in interface Collection<E>
Returns:
the number of elements in this collection

isEmpty

boolean isEmpty()

Specified by:
isEmpty in interface Collection<E>

iterator

Iterator<E> iterator()

Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface Iterable<E>

toArray

Object[] toArray()

Specified by:
toArray in interface Collection<E>

toArray

<T> T[] toArray(T[] a)

Specified by:
toArray in interface Collection<E>

containsAll

boolean containsAll(Collection<?> c)

Specified by:
containsAll in interface Collection<E>

addAll

boolean addAll(Collection<? extends E> c)

Specified by:
addAll in interface Collection<E>

removeAll

boolean removeAll(Collection<?> c)

Specified by:
removeAll in interface Collection<E>

retainAll

boolean retainAll(Collection<?> c)

Specified by:
retainAll in interface Collection<E>

clear

void clear()

Specified by:
clear in interface Collection<E>

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 © 2014 Hazelcast, Inc.. All Rights Reserved.