com.hazelcast.queue.impl.proxy
Class QueueProxyImpl<E>

java.lang.Object
  extended by com.hazelcast.spi.AbstractDistributedObject<QueueService>
      extended by com.hazelcast.queue.impl.proxy.QueueProxyImpl<E>
Type Parameters:
E -
All Implemented Interfaces:
BaseQueue<E>, DistributedObject, ICollection<E>, IQueue<E>, InitializingObject, Iterable<E>, Collection<E>, BlockingQueue<E>, Queue<E>

public class QueueProxyImpl<E>
extends AbstractDistributedObject<QueueService>
implements IQueue<E>, InitializingObject

Proxy implementation for the Queue.


Field Summary
 
Fields inherited from class com.hazelcast.spi.AbstractDistributedObject
PARTITIONING_STRATEGY
 
Constructor Summary
QueueProxyImpl(String name, QueueService queueService, NodeEngine nodeEngine)
           
 
Method Summary
 boolean add(E e)
           
 boolean addAll(Collection<? extends E> es)
           
 String addItemListener(ItemListener listener, boolean includeValue)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> objects)
           
 int drainTo(Collection<? super E> objects)
           
 int drainTo(Collection<? super E> objects, int i)
           
 E element()
           
 LocalQueueStats getLocalQueueStats()
          Returns LocalQueueStats for this queue.
 String getName()
          Returns the unique name for this DistributedObject.
 String getServiceName()
          Returns the service name for this object.
 void initialize()
           
 boolean isEmpty()
           
 Iterator<E> iterator()
           
 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 timeUnit)
          Inserts the specified element into this queue, waiting up to the specified wait time if necessary for space to become available.
 E peek()
           
 E poll()
          Retrieves and removes the head of this queue, or returns null if this queue is empty.
 E poll(long timeout, TimeUnit timeUnit)
          Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available.
 void put(E e)
           
 int remainingCapacity()
           
 E remove()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> objects)
           
 boolean removeItemListener(String registrationId)
           
 boolean retainAll(Collection<?> objects)
           
 int size()
           
 E take()
          Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.
protected  void throwExceptionIfNull(Object o)
           
 Object[] toArray()
           
<T> T[]
toArray(T[] ts)
           
 String toString()
           
 
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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.concurrent.BlockingQueue
remainingCapacity
 
Methods inherited from interface java.util.Collection
clear, equals, hashCode, isEmpty, size
 
Methods inherited from interface com.hazelcast.core.BaseQueue
size
 
Methods inherited from interface com.hazelcast.core.ICollection
addItemListener, getName, removeItemListener
 
Methods inherited from interface com.hazelcast.core.DistributedObject
destroy, getId, getPartitionKey, getServiceName
 
Methods inherited from interface com.hazelcast.spi.InitializingObject
initialize
 

Constructor Detail

QueueProxyImpl

public QueueProxyImpl(String name,
                      QueueService queueService,
                      NodeEngine nodeEngine)
Method Detail

getLocalQueueStats

public LocalQueueStats getLocalQueueStats()
Description copied from interface: IQueue
Returns LocalQueueStats for this queue. LocalQueueStats is the statistics for the local portion of this queue.

Specified by:
getLocalQueueStats in interface IQueue<E>
Returns:
this queue's local statistics.

add

public boolean add(E e)
Specified by:
add in interface Collection<E>
Specified by:
add in interface BlockingQueue<E>
Specified by:
add in interface Queue<E>

offer

public boolean offer(E e)
Description copied from interface: BaseQueue
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 BlockingQueue<E>
Specified by:
offer in interface Queue<E>
Parameters:
e - the element to add
Returns:
true if the element was added to this queue, false otherwise

put

public void put(E e)
         throws InterruptedException
Specified by:
put in interface BlockingQueue<E>
Throws:
InterruptedException

offer

public boolean offer(E e,
                     long timeout,
                     TimeUnit timeUnit)
              throws InterruptedException
Description copied from interface: BaseQueue
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 BlockingQueue<E>
Parameters:
e - the element to add
timeout - how long to wait before giving up, in units of unit
timeUnit - 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: BaseQueue
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 IQueue<E>
Specified by:
take in interface BlockingQueue<E>
Returns:
the head of this queue
Throws:
InterruptedException - if interrupted while waiting

poll

public E poll(long timeout,
              TimeUnit timeUnit)
       throws InterruptedException
Description copied from interface: BaseQueue
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 IQueue<E>
Specified by:
poll in interface BlockingQueue<E>
Parameters:
timeout - how long to wait before giving up, in units of unit
timeUnit - 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

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface BlockingQueue<E>

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<E>
Specified by:
contains in interface BlockingQueue<E>

drainTo

public int drainTo(Collection<? super E> objects)
Specified by:
drainTo in interface BlockingQueue<E>

drainTo

public int drainTo(Collection<? super E> objects,
                   int i)
Specified by:
drainTo in interface BlockingQueue<E>

remove

public E remove()
Specified by:
remove in interface Queue<E>

poll

public E poll()
Description copied from interface: BaseQueue
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 IQueue<E>
Specified by:
poll in interface Queue<E>
Returns:
the head of this queue, or null if this queue is empty

element

public E element()
Specified by:
element in interface Queue<E>

peek

public E peek()
Specified by:
peek in interface Queue<E>

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<E>

toArray

public <T> T[] toArray(T[] ts)
Specified by:
toArray in interface Collection<E>

containsAll

public boolean containsAll(Collection<?> objects)
Specified by:
containsAll in interface Collection<E>

addAll

public boolean addAll(Collection<? extends E> es)
Specified by:
addAll in interface Collection<E>

removeAll

public boolean removeAll(Collection<?> objects)
Specified by:
removeAll in interface Collection<E>

retainAll

public boolean retainAll(Collection<?> objects)
Specified by:
retainAll in interface Collection<E>

toString

public String toString()
Overrides:
toString in class AbstractDistributedObject<QueueService>

initialize

public void initialize()
Specified by:
initialize in interface InitializingObject

isEmpty

public boolean isEmpty()

size

public int size()

remainingCapacity

public int remainingCapacity()

clear

public void clear()

throwExceptionIfNull

protected void throwExceptionIfNull(Object o)

getServiceName

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

Specified by:
getServiceName in interface DistributedObject
Specified by:
getServiceName in class AbstractDistributedObject<QueueService>
Returns:
the service name for this object.

getName

public final 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.

addItemListener

public String addItemListener(ItemListener listener,
                              boolean includeValue)

removeItemListener

public boolean removeItemListener(String registrationId)


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