public abstract class GridCacheQueueAdapter<T> extends AbstractCollection<T> implements IgniteQueue<T>
IgniteQueue implementation.| Modifier and Type | Class and Description |
|---|---|
protected static class |
GridCacheQueueAdapter.AddProcessor |
protected static class |
GridCacheQueueAdapter.ClearProcessor |
protected static class |
GridCacheQueueAdapter.PollProcessor |
protected static class |
GridCacheQueueAdapter.RemoveProcessor |
| Modifier and Type | Field and Description |
|---|---|
protected GridCacheAdapter |
cache
Cache.
|
protected GridCacheContext<?,?> |
cctx
Cache context.
|
protected IgniteUuid |
id
Queue unique ID.
|
protected IgniteLogger |
log
Logger.
|
protected static int |
MAX_UPDATE_RETRIES |
protected static long |
QUEUE_REMOVED_IDX
Value returned by closure updating queue header indicating that queue was removed.
|
protected GridCacheQueueHeaderKey |
queueKey
Queue header key.
|
protected String |
queueName
Queue name.
|
protected static long |
RETRY_DELAY |
| Modifier | Constructor and Description |
|---|---|
protected |
GridCacheQueueAdapter(String queueName,
GridCacheQueueHeader hdr,
GridCacheContext<?,?> cctx) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T item) |
boolean |
bounded()
Returns
true if this queue is bounded. |
int |
capacity()
Gets maximum number of elements of the queue.
|
protected void |
checkRemoved(GridCacheQueueHeader hdr)
Checks queue state, throws
IllegalStateException if queue was removed. |
protected void |
checkRemoved(Long idx)
Checks result of closure modifying queue header, throws
IllegalStateException
if queue was removed. |
void |
clear() |
void |
clear(int batchSize)
Removes all of the elements from this queue.
|
void |
close()
Removes this queue.
|
boolean |
collocated()
Returns
true if this queue can be kept on the one node only. |
int |
drainTo(Collection<? super T> c) |
int |
drainTo(Collection<? super T> c,
int maxElements) |
T |
element() |
boolean |
equals(Object o) |
int |
hashCode() |
IgniteUuid |
id() |
protected org.apache.ignite.internal.processors.datastructures.GridCacheQueueItemKey |
itemKey(Long idx) |
Iterator<T> |
iterator() |
String |
name()
Gets queue name.
|
boolean |
offer(T item,
long timeout,
TimeUnit unit) |
void |
onHeaderChanged(GridCacheQueueHeader hdr) |
void |
onKernalStop()
Grid stop callback.
|
void |
onRemoved(boolean throw0)
Marks queue as removed.
|
T |
peek() |
T |
poll(long timeout,
TimeUnit unit) |
void |
put(T item) |
int |
remainingCapacity() |
T |
remove() |
boolean |
removed()
Gets status of queue.
|
protected abstract void |
removeItem(long rmvIdx)
Removes item with given index from queue.
|
int |
size() |
T |
take() |
String |
toString() |
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayprotected static final long QUEUE_REMOVED_IDX
protected static final int MAX_UPDATE_RETRIES
protected static final long RETRY_DELAY
protected final IgniteLogger log
protected final GridCacheContext<?,?> cctx
protected final GridCacheAdapter cache
protected final String queueName
protected final GridCacheQueueHeaderKey queueKey
protected final IgniteUuid id
protected GridCacheQueueAdapter(String queueName, GridCacheQueueHeader hdr, GridCacheContext<?,?> cctx)
queueName - Queue name.hdr - Queue hdr.cctx - Cache context.public String name()
name in interface IgniteQueue<T>public boolean add(T item)
add in interface Collection<T>add in interface BlockingQueue<T>add in interface Queue<T>add in interface IgniteQueue<T>add in class AbstractCollection<T>public boolean collocated()
true if this queue can be kept on the one node only.
Returns false if this queue can be kept on the many nodes.collocated in interface IgniteQueue<T>true if this queue is in collocated mode false otherwise.public int capacity()
capacity in interface IgniteQueue<T>Integer.MAX_SIZE will return.public boolean bounded()
true if this queue is bounded.bounded in interface IgniteQueue<T>true if this queue is bounded.public int size()
size in interface Collection<T>size in interface IgniteQueue<T>size in class AbstractCollection<T>@Nullable public T peek() throws IgniteException
peek in interface Queue<T>peek in interface IgniteQueue<T>IgniteExceptionpublic Iterator<T> iterator()
iterator in interface Iterable<T>iterator in interface Collection<T>iterator in interface IgniteQueue<T>iterator in class AbstractCollection<T>public void put(T item) throws IgniteException
put in interface BlockingQueue<T>put in interface IgniteQueue<T>IgniteExceptionpublic boolean offer(T item, long timeout, TimeUnit unit) throws IgniteException
offer in interface BlockingQueue<T>offer in interface IgniteQueue<T>IgniteException@Nullable public T take() throws IgniteException
take in interface BlockingQueue<T>take in interface IgniteQueue<T>IgniteException@Nullable public T poll(long timeout, TimeUnit unit) throws IgniteException
poll in interface BlockingQueue<T>poll in interface IgniteQueue<T>IgniteExceptionpublic int remainingCapacity()
remainingCapacity in interface BlockingQueue<T>public void clear()
clear in interface Collection<T>clear in interface IgniteQueue<T>clear in class AbstractCollection<T>public void clear(int batchSize)
throws IgniteException
clear in interface IgniteQueue<T>batchSize - Batch size.IgniteException - if operation failed.public int drainTo(Collection<? super T> c)
drainTo in interface BlockingQueue<T>public int drainTo(Collection<? super T> c, int maxElements)
drainTo in interface BlockingQueue<T>public boolean removed()
removed in interface IgniteQueue<T>true if queue was removed from cache false otherwise.protected final void checkRemoved(Long idx)
IllegalStateException
if queue was removed.idx - Result of closure execution.protected final void checkRemoved(@Nullable GridCacheQueueHeader hdr)
IllegalStateException if queue was removed.hdr - Queue hdr.public void onRemoved(boolean throw0)
throw0 - If true then throws IllegalStateException.public void onHeaderChanged(GridCacheQueueHeader hdr)
hdr - Queue header.public void onKernalStop()
public IgniteUuid id()
protected abstract void removeItem(long rmvIdx)
throws IgniteCheckedException
rmvIdx - Index of item to be removed.IgniteCheckedException - If failed.protected org.apache.ignite.internal.processors.datastructures.GridCacheQueueItemKey itemKey(Long idx)
idx - Item index.public void close()
close in interface Closeableclose in interface AutoCloseableclose in interface IgniteQueue<T>public boolean equals(Object o)
equals in interface Collection<T>equals in class Objectpublic int hashCode()
hashCode in interface Collection<T>hashCode in class Objectpublic String toString()
toString in class AbstractCollection<T>
Follow @ApacheIgnite
Ignite Fabric : ver. 1.2.0-incubating Release Date : June 16 2015