public interface GridCacheDataStructures
'java.util.concurrent' package, but all operations on them are grid-aware.
For example, if you increment GridCacheAtomicLong on one node, another node will
know about the change. Or if you add an element to GridCacheQueue on one node,
you can poll it on another node.| Modifier and Type | Method and Description |
|---|---|
GridCacheAtomicLong |
atomicLong(String name,
long initVal,
boolean create)
Will get a atomic long from cache and create one if it has not been created yet and
create flag
is true. |
<T> GridCacheAtomicReference<T> |
atomicReference(String name,
T initVal,
boolean create)
Will get a atomic reference from cache and create one if it has not been created yet and
create flag
is true. |
GridCacheAtomicSequence |
atomicSequence(String name,
long initVal,
boolean create)
Will get an atomic sequence from cache and create one if it has not been created yet and
create flag
is true. |
<T,S> GridCacheAtomicStamped<T,S> |
atomicStamped(String name,
T initVal,
S initStamp,
boolean create)
Will get a atomic stamped from cache and create one if it has not been created yet and
create flag
is true. |
GridCacheCountDownLatch |
countDownLatch(String name,
int cnt,
boolean autoDel,
boolean create)
Gets or creates count down latch.
|
<T> GridCacheQueue<T> |
queue(String name,
int cap,
boolean collocated,
boolean create)
Will get a named queue from cache and create one if it has not been created yet and
create flag
is true. |
boolean |
removeAtomicLong(String name)
Remove atomic long from cache.
|
boolean |
removeAtomicReference(String name)
Remove atomic reference from cache.
|
boolean |
removeAtomicSequence(String name)
Remove sequence from cache.
|
boolean |
removeAtomicStamped(String name)
Remove atomic stamped from cache.
|
boolean |
removeCountDownLatch(String name)
Removes count down latch from cache.
|
boolean |
removeQueue(String name)
Remove queue from cache.
|
boolean |
removeQueue(String name,
int batchSize)
Remove queue from cache.
|
boolean |
removeSet(String name)
Removes set from cache.
|
<T> GridCacheSet<T> |
set(String name,
boolean collocated,
boolean create)
Will get a named set from cache and create one if it has not been created yet and
create flag
is true. |
@Nullable GridCacheAtomicSequence atomicSequence(String name, long initVal, boolean create) throws GridException
create flag
is true.name - Sequence name.initVal - Initial value for sequence. If sequence already cached, initVal will be ignored.create - Boolean flag indicating whether data structure should be created if does not exist.GridException - If sequence could not be fetched or created.boolean removeAtomicSequence(String name) throws GridException
name - Sequence name.True if sequence has been removed, false otherwise.GridException - If remove failed.@Nullable GridCacheAtomicLong atomicLong(String name, long initVal, boolean create) throws GridException
create flag
is true.name - Name of atomic long.initVal - Initial value for atomic long. If atomic long already cached, initVal
will be ignored.create - Boolean flag indicating whether data structure should be created if does not exist.GridException - If atomic long could not be fetched or created.boolean removeAtomicLong(String name) throws GridException
name - Name of atomic long.True if atomic long has been removed, false otherwise.GridException - If removing failed.@Nullable <T> GridCacheQueue<T> queue(String name, int cap, boolean collocated, boolean create) throws GridException
create flag
is true.
If queue is present in cache already, queue properties will not be changed. Use
collocation for GridCacheMode.PARTITIONED caches if you have lots of relatively
small queues as it will make fetching, querying, and iteration a lot faster. If you have
few very large queues, then you should consider turning off collocation as they simply
may not fit in a single node's memory. However note that in this case
to get a single element off the queue all nodes may have to be queried.name - Name of queue.cap - Capacity of queue, 0 for unbounded queue.collocated - If true then all items within the same queue will be collocated on the same node.
Otherwise elements of the same queue maybe be cached on different nodes. If you have lots of relatively
small queues, then you should use collocation. If you have few large queues, then you should turn off
collocation. This parameter works only for GridCacheMode.PARTITIONED cache.create - Boolean flag indicating whether data structure should be created if does not exist.GridException - If remove failed.boolean removeQueue(String name) throws GridException
removeQueue(String, int) which allows to specify batch size. In that case
transaction will be split into multiple transactions which will have upto batchSize
elements in it.name - Name queue.True if queue has been removed and false if it's not cached.GridException - If remove failed.boolean removeQueue(String name, int batchSize) throws GridException
batchSize elements in them. For larger queues, this
method is preferrable over removeQueue(String) which will create only
one transaction for the whole operation.name - Name queue.batchSize - Batch size.True if queue has been removed and false if it's not cached.GridException - If remove failed.@Nullable <T> GridCacheSet<T> set(String name, boolean collocated, boolean create) throws GridException
create flag
is true.name - Set name.collocated - If true then all items within the same set will be collocated on the same node.
Otherwise elements of the same set maybe be cached on different nodes. This parameter works only
for GridCacheMode.PARTITIONED cache.create - Flag indicating whether set should be created if does not exist.GridException - If failed.boolean removeSet(String name) throws GridException
name - Set name.True if set has been removed and false if it's not cached.GridException - If failed.@Nullable <T> GridCacheAtomicReference<T> atomicReference(String name, @Nullable T initVal, boolean create) throws GridException
create flag
is true.name - Atomic reference name.initVal - Initial value for atomic reference. If atomic reference already cached,
initVal will be ignored.create - Boolean flag indicating whether data structure should be created if does not exist.GridException - If atomic reference could not be fetched or created.boolean removeAtomicReference(String name) throws GridException
name - Atomic reference name.True if atomic reference has been removed, false otherwise.GridException - If remove failed.@Nullable <T,S> GridCacheAtomicStamped<T,S> atomicStamped(String name, @Nullable T initVal, @Nullable S initStamp, boolean create) throws GridException
create flag
is true.name - Atomic stamped name.initVal - Initial value for atomic stamped. If atomic stamped already cached,
initVal will be ignored.initStamp - Initial stamp for atomic stamped. If atomic stamped already cached,
initStamp will be ignored.create - Boolean flag indicating whether data structure should be created if does not exist.GridException - If atomic stamped could not be fetched or created.boolean removeAtomicStamped(String name) throws GridException
name - Atomic stamped name.True if atomic stamped has been removed, false otherwise.GridException - If remove failed.@Nullable GridCacheCountDownLatch countDownLatch(String name, int cnt, boolean autoDel, boolean create) throws GridException
create flag
is true, it is created using provided name and count parameter.name - Name of the latch.cnt - Count for new latch creation.autoDel - True to automatically delete latch from cache
when its count reaches zero.create - Boolean flag indicating whether data structure should be created if does not exist.GridException - If operation failed.boolean removeCountDownLatch(String name) throws GridException
name - Name of the latch.GridException - If operation failed.Copyright © 2014. All rights reserved.