org.apache.ignite.internal.util

## Class GridSynchronizedMap<K,V>

- java.lang.Object
- - org.jsr166.ConcurrentHashMap8<K,V>
  - - org.apache.ignite.internal.util.GridSynchronizedMap<K,V>

All Implemented Interfaces:
  Externalizable, Serializable, ConcurrentMap<K,V>, Map<K,V>

    public class GridSynchronizedMap<K,V>
    extends ConcurrentHashMap8<K,V>
    implements Externalizable

Synchronized map for cache values that is safe to update in-place. Main reason for this map is to provide snapshot-guarantee for serialization and keep concurrent iterators.

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from class org.jsr166.ConcurrentHashMap8

`ConcurrentHashMap8.Action<A>, ConcurrentHashMap8.BiAction<A,B>, ConcurrentHashMap8.BiFun<A,B,T>, ConcurrentHashMap8.DoubleByDoubleToDouble, ConcurrentHashMap8.DoubleToDouble, ConcurrentHashMap8.EntrySetView<K,V>, ConcurrentHashMap8.Fun<A,T>, ConcurrentHashMap8.Generator<T>, ConcurrentHashMap8.IntByIntToInt, ConcurrentHashMap8.IntToInt, ConcurrentHashMap8.KeySetView<K,V>, ConcurrentHashMap8.LongByLongToLong, ConcurrentHashMap8.LongToLong, ConcurrentHashMap8.ObjectByObjectToDouble<A,B>, ConcurrentHashMap8.ObjectByObjectToInt<A,B>, ConcurrentHashMap8.ObjectByObjectToLong<A,B>, ConcurrentHashMap8.ObjectToDouble<A>, ConcurrentHashMap8.ObjectToInt<A>, ConcurrentHashMap8.ObjectToLong<A>, ConcurrentHashMap8.Spliterator<T>, ConcurrentHashMap8.ValuesView<K,V>`

### Nested classes/interfaces inherited from interface java.util.Map

`Map.Entry<K,V>`

### Constructor Summary

Constructors
Constructor and Description
`GridSynchronizedMap()`

### Method Summary

Methods
`void` `clear()` Removes all of the mappings from this map.
`V` `put(K key, V val)` Maps the specified key to the specified value in this table.
`void` `putAll(Map<? extends K,? extends V> m)` Copies all of the mappings from the specified map to this one.
`V` `putIfAbsent(K key, V val)`
`void` `readExternal(ObjectInput in)`
`V` `remove(Object key)` Removes the key (and its corresponding value) from this map.
`boolean` `remove(Object key, Object val)`
`V` `replace(K key, V val)`
`boolean` `replace(K key, V oldVal, V newVal)`
`void` `writeExternal(ObjectOutput out)`

### Methods inherited from class org.jsr166.ConcurrentHashMap8

`compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, entrySpliterator, equals, get, getValueOrDefault, hashCode, isEmpty, keys, keySet, keySet, keySpliterator, mappingCount, merge, newKeySet, newKeySet, size, toString, values, valueSpliterator`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### GridSynchronizedMap

    public GridSynchronizedMap()

### Method Detail

#### putIfAbsent

    public V putIfAbsent(K key,
                V val)

Specified by:
  `putIfAbsent` in interface `ConcurrentMap<K,V>`
Overrides:
  `putIfAbsent` in class `ConcurrentHashMap8<K,V>`
Returns:
  the previous value associated with the specified key, or `null` if there was no mapping for the key

#### remove

    public boolean remove(Object key,
                 Object val)

Specified by:
  `remove` in interface `ConcurrentMap<K,V>`
Overrides:
  `remove` in class `ConcurrentHashMap8<K,V>`

#### replace

    public boolean replace(K key,
                  V oldVal,
                  V newVal)

Specified by:
  `replace` in interface `ConcurrentMap<K,V>`
Overrides:
  `replace` in class `ConcurrentHashMap8<K,V>`

#### replace

    public V replace(K key,
            V val)

Specified by:
  `replace` in interface `ConcurrentMap<K,V>`
Overrides:
  `replace` in class `ConcurrentHashMap8<K,V>`
Returns:
  the previous value associated with the specified key, or `null` if there was no mapping for the key

#### put

    public V put(K key,
        V val)

Maps the specified key to the specified value in this table. Neither the key nor the value can be null.

The value can be retrieved by calling the `get` method with a key that is equal to the original key.

Specified by:
  `put` in interface `Map<K,V>`
Overrides:
  `put` in class `ConcurrentHashMap8<K,V>`
Parameters:
  `key` - key with which the specified value is to be associated
  `val` - value to be associated with the specified key
Returns:
  the previous value associated with `key`, or `null` if there was no mapping for `key`

#### remove

    public V remove(Object key)

Removes the key (and its corresponding value) from this map. This method does nothing if the key is not in the map.

Specified by:
  `remove` in interface `Map<K,V>`
Overrides:
  `remove` in class `ConcurrentHashMap8<K,V>`
Parameters:
  `key` - the key that needs to be removed
Returns:
  the previous value associated with `key`, or `null` if there was no mapping for `key`

#### putAll

    public void putAll(Map<? extends K,? extends V> m)

Copies all of the mappings from the specified map to this one. These mappings replace any mappings that this map had for any of the keys currently in the specified map.

Specified by:
  `putAll` in interface `Map<K,V>`
Overrides:
  `putAll` in class `ConcurrentHashMap8<K,V>`
Parameters:
  `m` - mappings to be stored in this map

#### clear

    public void clear()

Removes all of the mappings from this map.

Specified by:
  `clear` in interface `Map<K,V>`
Overrides:
  `clear` in class `ConcurrentHashMap8<K,V>`

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.5.0.final
Release Date | : December 29 2015