Package com.hazelcast.transaction
Interface TransactionalQueue<E>
-
- Type Parameters:
E
- the type of elements held in this collection
- All Superinterfaces:
BaseQueue<E>
,DistributedObject
,TransactionalObject
public interface TransactionalQueue<E> extends TransactionalObject, BaseQueue<E>
Transactional implementation ofBaseQueue
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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, java.util.concurrent.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, java.util.concurrent.TimeUnit unit)
E
poll()
Retrieves and removes the head of this queue, or returnsnull
if this queue is empty.E
poll(long timeout, java.util.concurrent.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, getDestroyContextForTenant, getName, getPartitionKey, getServiceName
-
-
-
-
Method Detail
-
offer
boolean offer(@Nonnull E e)
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions. Returnstrue
upon success andfalse
if no space is currently available.
-
offer
boolean offer(@Nonnull E e, long timeout, @Nonnull java.util.concurrent.TimeUnit unit) throws java.lang.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 interfaceBaseQueue<E>
- Parameters:
e
- the element to addtimeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determines how to interpret thetimeout
parameter- Returns:
true
if successful, orfalse
if the specified waiting time elapses before space is available- Throws:
java.lang.InterruptedException
- if interrupted while waiting
-
take
@Nonnull E take() throws java.lang.InterruptedException
Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.
-
poll
E poll()
Retrieves and removes the head of this queue, or returnsnull
if this queue is empty.
-
poll
E poll(long timeout, @Nonnull java.util.concurrent.TimeUnit unit) throws java.lang.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 interfaceBaseQueue<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:
java.lang.InterruptedException
- if interrupted while waiting
-
peek
E peek()
-
peek
E peek(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
-