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 <mwu0...@gmail.com> 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 h2-database+unsubscr...@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','h2-database%2bunsubscr...@googlegroups.com');>
> .
> To post to this group, send email to h2-database@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','h2-database@googlegroups.com');>.
> 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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
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