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 classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
| 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 |
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.