com.hazelcast.queue.impl.tx
Class TransactionalQueueProxy<E>
java.lang.Object
com.hazelcast.spi.AbstractDistributedObject<QueueService>
com.hazelcast.queue.impl.tx.TransactionalQueueProxySupport
com.hazelcast.queue.impl.tx.TransactionalQueueProxy<E>
- Type Parameters:
E
-
- All Implemented Interfaces:
- BaseQueue<E>, DistributedObject, TransactionalQueue<E>, TransactionalObject
public class TransactionalQueueProxy<E>
- extends TransactionalQueueProxySupport
- implements TransactionalQueue<E>
Provides proxy for the Transactional Queue.
Method Summary |
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. |
E |
take()
Retrieves and removes the head of this queue, waiting if necessary
until an element becomes available. |
String |
toString()
|
Methods inherited from class com.hazelcast.spi.AbstractDistributedObject |
destroy, equals, getId, getNameAsPartitionAwareData, getNodeEngine, getPartitionKey, getService, hashCode, invalidate, postDestroy, throwNotActiveException |
TransactionalQueueProxy
public TransactionalQueueProxy(NodeEngine nodeEngine,
QueueService service,
String name,
TransactionSupport tx)
offer
public boolean offer(E e)
- Description copied from interface:
TransactionalQueue
- 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>
- Specified by:
offer
in interface TransactionalQueue<E>
- Parameters:
e
- the element to add
- Returns:
- true if the element was added to this queue,
false otherwise
offer
public boolean offer(E e,
long timeout,
TimeUnit unit)
throws InterruptedException
- Description copied from interface:
TransactionalQueue
- 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 TransactionalQueue<E>
- Parameters:
e
- the element to addtimeout
- how long to wait before giving up, in units of
unitunit
- 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
public E take()
throws InterruptedException
- Description copied from interface:
TransactionalQueue
- Retrieves and removes the head of this queue, waiting if necessary
until an element becomes available.
- Specified by:
take
in interface BaseQueue<E>
- Specified by:
take
in interface TransactionalQueue<E>
- Returns:
- the head of this queue
- Throws:
InterruptedException
- if interrupted while waiting
poll
public E poll()
- Description copied from interface:
TransactionalQueue
- 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 TransactionalQueue<E>
- Returns:
- the head of this queue, or null if this queue is empty
poll
public E poll(long timeout,
TimeUnit unit)
throws InterruptedException
- Description copied from interface:
TransactionalQueue
- 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 TransactionalQueue<E>
- Parameters:
timeout
- how long to wait before giving up, in units of
unitunit
- 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
public E peek()
- Description copied from interface:
TransactionalQueue
-
- Specified by:
peek
in interface TransactionalQueue<E>
peek
public E peek(long timeout,
TimeUnit unit)
throws InterruptedException
- Description copied from interface:
TransactionalQueue
-
- Specified by:
peek
in interface TransactionalQueue<E>
- Throws:
InterruptedException
toString
public String toString()
- Overrides:
toString
in class AbstractDistributedObject<QueueService>
Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.