hi mate i have a global Hashtable in my class, and two thread A and B that work with her.
A reads from HashTable and B write in Hashtable.. is there a problem of mutual exclusion ? i need to syncrhonize it or Hashtable class is safe ?
hi mate i have a global Hashtable in my class, and two thread A
Share
Hashtableis a thread-safe implementation of theMapinterface.In regular put and get operations you will be safe. However, when you will iterate on it in one thread and modify its contents from another thread, you will have
ConcurrentModificationExceptionissues. So, when iterating, make sure you iterate on a copy of the originalHashtable.