com.hazelcast.client.txn.proxy
Class ClientTxnQueueProxy<E>

java.lang.Object
  extended by com.hazelcast.client.txn.proxy.ClientTxnQueueProxy<E>
All Implemented Interfaces:
BaseQueue<E>, DistributedObject, TransactionalQueue<E>, TransactionalObject

public class ClientTxnQueueProxy<E>
extends Object
implements TransactionalQueue<E>

Author:
ali 6/7/13

Constructor Summary
ClientTxnQueueProxy(String name, TransactionContextProxy proxy)
           
 
Method Summary
 void destroy()
          Destroys this object cluster-wide.
 Object getId()
          Returns the unique id for this object.
 String getName()
          Returns the unique name for this DistributedObject.
 String getPartitionKey()
          Returns the key of the partition that this DistributedObject is assigned to.
 String getServiceName()
          Returns the service name for this object.
 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.
 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.hazelcast.core.DistributedObject
destroy, getId, getPartitionKey
 

Constructor Detail

ClientTxnQueueProxy

public ClientTxnQueueProxy(String name,
                           TransactionContextProxy proxy)
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

size

public int size()
Description copied from interface: TransactionalQueue
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 TransactionalQueue<E>
Returns:
the number of elements in this collection

getName

public String getName()
Description copied from interface: DistributedObject
Returns the unique name for this DistributedObject. The returned value will never be null.

Specified by:
getName in interface DistributedObject
Returns:
the unique name for this object.

getServiceName

public String getServiceName()
Description copied from interface: DistributedObject
Returns the service name for this object.

Specified by:
getServiceName in interface DistributedObject
Returns:
the service name for this object.

destroy

public final void destroy()
Description copied from interface: DistributedObject
Destroys this object cluster-wide. Clears and releases all resources for this object.

Specified by:
destroy in interface DistributedObject

getId

public Object getId()
Description copied from interface: DistributedObject
Returns the unique id for this object.

Specified by:
getId in interface DistributedObject
Returns:
id the of this instance

getPartitionKey

public String getPartitionKey()
Description copied from interface: DistributedObject
Returns the key of the partition that this DistributedObject is assigned to. The returned value only has meaning for a non-partitioned data structure like an IAtomicLong. For a partitioned data structure like an IMap, the returned value will not be null, but otherwise undefined.

Specified by:
getPartitionKey in interface DistributedObject
Returns:
the partition key.


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.