I am storing a HashMap object in my ServletContext. But Multiple Request thread are reading and Modifying this HashMap.
As i belive the ServletContext objects are sh
As Suggested by @Artem Moskalev, You can use ConcurrentHashMap and use putIfAbsent method to store the object/values instead of simple put method.
@Artem Moskalev
putIfAbsent
put
I wanted to add this comment below @Artem Moskalev's answer but i don't have enough reputation for this.
@Artem Moskalev'