Class GridCacheQueueProxy<T>
- java.lang.Object
-
- org.apache.ignite.internal.processors.datastructures.GridCacheQueueProxy<T>
-
- All Implemented Interfaces:
Closeable,Externalizable,Serializable,AutoCloseable,Iterable<T>,Collection<T>,BlockingQueue<T>,Queue<T>,IgniteQueue<T>
public class GridCacheQueueProxy<T> extends Object implements IgniteQueue<T>, Externalizable
Cache queue proxy.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GridCacheQueueProxy()Required byExternalizable.GridCacheQueueProxy(GridCacheContext cctx, GridCacheQueueAdapter<T> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(T item)booleanaddAll(Collection<? extends T> items)<R> RaffinityCall(IgniteCallable<R> job)Executes given job on collocated queue on the node where the queue is located (a.k.a. affinity co-location).voidaffinityRun(IgniteRunnable job)Executes given job on collocated queue on the node where the queue is located (a.k.a. affinity co-location).booleanbounded()Returnstrueif this queue is bounded.intcapacity()Gets maximum number of elements of the queue.voidclear()voidclear(int batchSize)Removes all of the elements from this queue.voidclose()Removes this queue.booleancollocated()Returnstrueif this queue can be kept on the one node only.booleancontains(Object item)booleancontainsAll(Collection<?> items)GridCacheQueueAdapter<T>delegate()intdrainTo(Collection<? super T> c)intdrainTo(Collection<? super T> c, int maxElements)Telement()booleanequals(Object o)intgroupId()StringgroupName()inthashCode()booleanisEmpty()Iterator<T>iterator()Stringname()Gets queue name.booleanoffer(T item)booleanoffer(T item, long timeout, TimeUnit unit)Tpeek()Tpoll()Tpoll(long timeout, TimeUnit unit)voidput(T item)voidreadExternal(ObjectInput in)protected ObjectreadResolve()Reconstructs object on unmarshalling.intremainingCapacity()Tremove()booleanremove(Object item)booleanremoveAll(Collection<?> items)booleanremoved()Gets status of queue.booleanretainAll(Collection<?> items)intsize()Ttake()Object[]toArray()<T1> T1[]toArray(T1[] a)StringtoString()<V1> IgniteQueue<V1>withKeepBinary()Returns queue that will operate with binary objects.voidwriteExternal(ObjectOutput out)-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
-
-
-
Constructor Detail
-
GridCacheQueueProxy
public GridCacheQueueProxy()
Required byExternalizable.
-
GridCacheQueueProxy
public GridCacheQueueProxy(GridCacheContext cctx, GridCacheQueueAdapter<T> delegate)
- Parameters:
cctx- Cache context.delegate- Delegate queue.
-
-
Method Detail
-
delegate
public GridCacheQueueAdapter<T> delegate()
- Returns:
- Delegate queue.
-
add
public boolean add(T item)
- Specified by:
addin interfaceBlockingQueue<T>- Specified by:
addin interfaceCollection<T>- Specified by:
addin interfaceIgniteQueue<T>- Specified by:
addin interfaceQueue<T>
-
offer
public boolean offer(T item)
- Specified by:
offerin interfaceBlockingQueue<T>- Specified by:
offerin interfaceIgniteQueue<T>- Specified by:
offerin interfaceQueue<T>
-
addAll
public boolean addAll(Collection<? extends T> items)
- Specified by:
addAllin interfaceCollection<T>- Specified by:
addAllin interfaceIgniteQueue<T>
-
contains
public boolean contains(Object item)
- Specified by:
containsin interfaceBlockingQueue<T>- Specified by:
containsin interfaceCollection<T>- Specified by:
containsin interfaceIgniteQueue<T>
-
containsAll
public boolean containsAll(Collection<?> items)
- Specified by:
containsAllin interfaceCollection<T>- Specified by:
containsAllin interfaceIgniteQueue<T>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<T>- Specified by:
clearin interfaceIgniteQueue<T>
-
remove
public boolean remove(Object item)
- Specified by:
removein interfaceBlockingQueue<T>- Specified by:
removein interfaceCollection<T>- Specified by:
removein interfaceIgniteQueue<T>
-
removeAll
public boolean removeAll(Collection<?> items)
- Specified by:
removeAllin interfaceCollection<T>- Specified by:
removeAllin interfaceIgniteQueue<T>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<T>- Specified by:
isEmptyin interfaceIgniteQueue<T>
-
iterator
public Iterator<T> iterator()
- Specified by:
iteratorin interfaceCollection<T>- Specified by:
iteratorin interfaceIgniteQueue<T>- Specified by:
iteratorin interfaceIterable<T>
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceCollection<T>- Specified by:
toArrayin interfaceIgniteQueue<T>
-
toArray
public <T1> T1[] toArray(T1[] a)
- Specified by:
toArrayin interfaceCollection<T>- Specified by:
toArrayin interfaceIgniteQueue<T>
-
retainAll
public boolean retainAll(Collection<?> items)
- Specified by:
retainAllin interfaceCollection<T>- Specified by:
retainAllin interfaceIgniteQueue<T>
-
size
public int size()
- Specified by:
sizein interfaceCollection<T>- Specified by:
sizein interfaceIgniteQueue<T>
-
poll
@Nullable public T poll()
-
peek
@Nullable public T peek()
-
clear
public void clear(int batchSize)
Removes all of the elements from this queue. Method is used in massive queues with huge numbers of elements.- Specified by:
clearin interfaceIgniteQueue<T>- Parameters:
batchSize- Batch size.
-
remainingCapacity
public int remainingCapacity()
- Specified by:
remainingCapacityin interfaceBlockingQueue<T>
-
drainTo
public int drainTo(Collection<? super T> c)
- Specified by:
drainToin interfaceBlockingQueue<T>
-
drainTo
public int drainTo(Collection<? super T> c, int maxElements)
- Specified by:
drainToin interfaceBlockingQueue<T>
-
put
public void put(T item)
- Specified by:
putin interfaceBlockingQueue<T>- Specified by:
putin interfaceIgniteQueue<T>
-
offer
public boolean offer(T item, long timeout, TimeUnit unit)
- Specified by:
offerin interfaceBlockingQueue<T>- Specified by:
offerin interfaceIgniteQueue<T>
-
take
@Nullable public T take()
- Specified by:
takein interfaceBlockingQueue<T>- Specified by:
takein interfaceIgniteQueue<T>
-
poll
@Nullable public T poll(long timeout, TimeUnit unit)
- Specified by:
pollin interfaceBlockingQueue<T>- Specified by:
pollin interfaceIgniteQueue<T>
-
close
public void close()
Removes this queue.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceIgniteQueue<T>
-
name
public String name()
Gets queue name.- Specified by:
namein interfaceIgniteQueue<T>- Returns:
- Queue name.
-
groupName
public String groupName()
- Returns:
- Group name for queue.
-
groupId
public int groupId()
- Returns:
- Group id for queue.
-
capacity
public int capacity()
Gets maximum number of elements of the queue.- Specified by:
capacityin interfaceIgniteQueue<T>- Returns:
- Maximum number of elements. If queue is unbounded
Integer.MAX_SIZEwill return.
-
bounded
public boolean bounded()
Returnstrueif this queue is bounded.- Specified by:
boundedin interfaceIgniteQueue<T>- Returns:
trueif this queue is bounded.
-
collocated
public boolean collocated()
Returnstrueif this queue can be kept on the one node only. Returnsfalseif this queue can be kept on the many nodes.- Specified by:
collocatedin interfaceIgniteQueue<T>- Returns:
trueif this queue is incollocatedmodefalseotherwise.
-
removed
public boolean removed()
Gets status of queue.- Specified by:
removedin interfaceIgniteQueue<T>- Returns:
trueif queue was removed from cachefalseotherwise.
-
affinityRun
public void affinityRun(IgniteRunnable job)
Executes given job on collocated queue on the node where the queue is located (a.k.a. affinity co-location).This is not supported for non-collocated queues.
- Specified by:
affinityRunin interfaceIgniteQueue<T>- Parameters:
job- Job which will be co-located with the queue.
-
affinityCall
public <R> R affinityCall(IgniteCallable<R> job)
Executes given job on collocated queue on the node where the queue is located (a.k.a. affinity co-location).This is not supported for non-collocated queues.
- Specified by:
affinityCallin interfaceIgniteQueue<T>- Type Parameters:
R- Type of the job result.- Parameters:
job- Job which will be co-located with the queue.- Returns:
- Job result.
-
withKeepBinary
public <V1> IgniteQueue<V1> withKeepBinary()
Returns queue that will operate with binary objects. This is similar toIgniteCache.withKeepBinary()but for queues.- Specified by:
withKeepBinaryin interfaceIgniteQueue<T>- Type Parameters:
V1- Type of the queued binary objects.- Returns:
- New queue instance for binary objects.
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<T>- Overrides:
hashCodein classObject
-
equals
public boolean equals(Object o)
- Specified by:
equalsin interfaceCollection<T>- Overrides:
equalsin classObject
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
readResolve
protected Object readResolve() throws ObjectStreamException
Reconstructs object on unmarshalling.- Returns:
- Reconstructed object.
- Throws:
ObjectStreamException- Thrown in case of unmarshalling error.
-
-