Package com.hazelcast.collection
Interface IQueue<E>
- Type Parameters:
E
- queue item type
- All Superinterfaces:
BaseQueue<E>
,BlockingQueue<E>
,Collection<E>
,DistributedObject
,ICollection<E>
,Iterable<E>
,Queue<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:
-
Method Summary
Modifier and TypeMethodDescriptionpoll()
Retrieves and removes the head of this queue, or returnsnull
if this queue is empty.Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available.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.Collection
addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
Methods inherited from interface com.hazelcast.core.DistributedObject
destroy, getPartitionKey, getServiceName
Methods inherited from interface com.hazelcast.collection.ICollection
addItemListener, getName, removeItemListener
-
Method Details
-
poll
E poll()Retrieves and removes the head of this queue, or returnsnull
if this queue is empty. -
poll
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 interfaceBaseQueue<E>
- Specified by:
poll
in interfaceBlockingQueue<E>
- Parameters:
timeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
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
Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.- Specified by:
take
in interfaceBaseQueue<E>
- Specified by:
take
in interfaceBlockingQueue<E>
- Returns:
- the head of this queue
- Throws:
InterruptedException
- if interrupted while waiting
-