public class GridCacheDataStructuresImpl<K,V> extends Object implements GridCacheDataStructures
| Constructor and Description |
|---|
GridCacheDataStructuresImpl(GridCacheContext<K,V> cctx) |
| 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. |
public GridCacheDataStructuresImpl(GridCacheContext<K,V> cctx)
cctx - Cache context.public GridCacheAtomicSequence atomicSequence(String name, long initVal, boolean create) throws GridException
create flag
is true.atomicSequence in interface GridCacheDataStructuresname - 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.public boolean removeAtomicSequence(String name) throws GridException
removeAtomicSequence in interface GridCacheDataStructuresname - Sequence name.True if sequence has been removed, false otherwise.GridException - If remove failed.public GridCacheAtomicLong atomicLong(String name, long initVal, boolean create) throws GridException
create flag
is true.atomicLong in interface GridCacheDataStructuresname - 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.public boolean removeAtomicLong(String name) throws GridException
removeAtomicLong in interface GridCacheDataStructuresname - Name of atomic long.True if atomic long has been removed, false otherwise.GridException - If removing failed.public <T> GridCacheAtomicReference<T> atomicReference(String name, T initVal, boolean create) throws GridException
create flag
is true.atomicReference in interface GridCacheDataStructuresname - 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.public boolean removeAtomicReference(String name) throws GridException
removeAtomicReference in interface GridCacheDataStructuresname - Atomic reference name.True if atomic reference has been removed, false otherwise.GridException - If remove failed.public <T,S> GridCacheAtomicStamped<T,S> atomicStamped(String name, T initVal, S initStamp, boolean create) throws GridException
create flag
is true.atomicStamped in interface GridCacheDataStructuresname - 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.public boolean removeAtomicStamped(String name) throws GridException
removeAtomicStamped in interface GridCacheDataStructuresname - Atomic stamped name.True if atomic stamped has been removed, false otherwise.GridException - If remove failed.public <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.queue in interface GridCacheDataStructuresname - 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.public boolean removeQueue(String name) throws GridException
GridCacheDataStructures.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.removeQueue in interface GridCacheDataStructuresname - Name queue.True if queue has been removed and false if it's not cached.GridException - If remove failed.public boolean removeQueue(String name, int batchSize) throws GridException
batchSize elements in them. For larger queues, this
method is preferrable over GridCacheDataStructures.removeQueue(String) which will create only
one transaction for the whole operation.removeQueue in interface GridCacheDataStructuresname - Name queue.batchSize - Batch size.True if queue has been removed and false if it's not cached.GridException - If remove failed.@Nullable public <T> GridCacheSet<T> set(String name, boolean collocated, boolean create) throws GridException
create flag
is true.set in interface GridCacheDataStructuresname - 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.public boolean removeSet(String name) throws GridException
removeSet in interface GridCacheDataStructuresname - Set name.True if set has been removed and false if it's not cached.GridException - If failed.@Nullable public 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.countDownLatch in interface GridCacheDataStructuresname - 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.public boolean removeCountDownLatch(String name) throws GridException
removeCountDownLatch in interface GridCacheDataStructuresname - Name of the latch.GridException - If operation failed.Copyright © 2014. All rights reserved.