Hi,

The get method is thread-safe. The MVMap implements ConcurrentMap which
implies thread-safety.

Thread-safe method doesn't need to be synchronized. For example,
String.hashCode is not synchronized, but is thread-safe.

Regards,
Thomas


On Friday, June 9, 2017, Michael Wu <[email protected]> wrote:

> Hi,
> I am learning to use the MVMap class.  I read the source code and found
> that the following methods are all synchronized except the get(...) method:
>
> public synchronized V put(K key, V value)
> public synchronized void clear()
> public synchronized V putIfAbsent(K key, V value)
> public synchronized boolean remove(Object key, Object value)
> public synchronized boolean replace(K key, V oldValue, V newValue)
> public synchronized V replace(K key, V value)
>
> Looks it is not thread safe to use the get(...) method:
>
> public V get(Object key)
>
> Is this an error?  Can anyone help?
>
> Thanks in advance!
> Michael
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <javascript:_e(%7B%7D,'cvml','h2-database%[email protected]');>
> .
> To post to this group, send email to [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
> Visit this group at https://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to