com.hazelcast.queue.impl.tx
Class TransactionalQueueProxy<E>

java.lang.Object
  extended by com.hazelcast.spi.AbstractDistributedObject<QueueService>
      extended by com.hazelcast.queue.impl.tx.TransactionalQueueProxySupport
          extended by 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.


Field Summary
 
Fields inherited from class com.hazelcast.queue.impl.tx.TransactionalQueueProxySupport
config, name, partitionId, tx
 
Fields inherited from class com.hazelcast.spi.AbstractDistributedObject
PARTITIONING_STRATEGY
 
Constructor Summary
TransactionalQueueProxy(NodeEngine nodeEngine, QueueService service, String name, TransactionSupport tx)
           
 
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.queue.impl.tx.TransactionalQueueProxySupport
checkTransactionState, getName, getServiceName, offerInternal, peekInternal, pollInternal, size
 
Methods inherited from class com.hazelcast.spi.AbstractDistributedObject
destroy, equals, getId, getNameAsPartitionAwareData, getNodeEngine, getPartitionKey, getService, hashCode, invalidate, postDestroy, throwNotActiveException
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.hazelcast.core.TransactionalQueue
size
 
Methods inherited from interface com.hazelcast.core.DistributedObject
destroy, getId, getName, getPartitionKey, getServiceName
 

Constructor Detail

TransactionalQueueProxy

public TransactionalQueueProxy(NodeEngine nodeEngine,
                               QueueService service,
                               String name,
                               TransactionSupport tx)
Method Detail

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 add
timeout - how long to wait before giving up, in units of unit
unit - 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 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

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.