GridGain™ 4.3.1e
Enterprise "Big Data" Edition

org.gridgain.grid
Interface GridNodeLocal<K,V>

All Superinterfaces:
ConcurrentMap<K,V>, GridMetadataAware, Map<K,V>, Serializable

public interface GridNodeLocal<K,V>
extends ConcurrentMap<K,V>, GridMetadataAware

Defines interface for node-local storage.

GridNodeLocal is similar to ThreadLocal in a way that its values are not distributed and kept only on local node (similar like ThreadLocal values are attached to the current thread only). Node-local values are used primarily by closures executed from the remote nodes to keep intermediate state on the local node between executions.

GridNodeLocal essentially is a ConcurrentMap with a few additional methods, so it is fairly trivial to use.

You can get an instance of GridNodeLocal by calling Grid.nodeLocal() method.

 

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Method Summary
 V addIfAbsent(K key, Callable<V> dflt)
          Gets the value with given key.
 V addIfAbsent(K key, V val)
          Unlike its sibling method ConcurrentMap.putIfAbsent(Object, Object) this method returns current mapping from the map.
 
Methods inherited from interface java.util.concurrent.ConcurrentMap
putIfAbsent, remove, replace, replace
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from interface org.gridgain.grid.GridMetadataAware
addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, removeMeta, removeMeta, replaceMeta
 

Method Detail

addIfAbsent

V addIfAbsent(K key,
              @Nullable
              Callable<V> dflt)
Gets the value with given key. If that value does not exist, calls given closure to get the default value, puts it into the map and returns it. If closure is null return null.

Parameters:
key - Key to get the value for.
dflt - Default value producing closure.
Returns:
Value for the key or the value produced by the closure if key does not exist in the map. Return null if key is not found and closure is null.

addIfAbsent

V addIfAbsent(K key,
              V val)
Unlike its sibling method ConcurrentMap.putIfAbsent(Object, Object) this method returns current mapping from the map.

Parameters:
key - Key.
val - Value to put if one does not exist.
Returns:
Current mapping for a given key.

GridGain™ 4.3.1e
Enterprise "Big Data" Edition

GridGain - In-Memory Big Data
Enterprise "Big Data" Edition, ver. 4.3.1e.10112012
2012 Copyright © GridGain Systems
Follow us:   Follow GridGain on Github Join GridGain User Group Follow GridGain on Twitter Follow GridGain on Vimeo