ravi v kumar: Is each session object use different treemap and arraylist or access the same collect across different session objects?
ravi v kumar: Is it good way to do it??
sarvesh: The same map/list is used by all threads.
sarvesh: Simply creating a synchronized instance of a collection/map will not make the collection/map thread-safe. It has to be accessed only from synchronized blocks.
(Yanked from javadoc)
It is imperative that the user manually synchronize on the returned list when iterating over it
sarvesh: java.util.concurrent.CopyOnWriteArrayList is an excellent alternate to synchronized arrayList. CopyOnWriteArrayList doesnt require access to be synchronized explicitly.i.e you dont have to follow the idiom specified above if CopyOnWriteArrayList is used. Concurrency is taken care internally.
sarvesh: However,there is no concurrent equivalent for TreeMap.
Nitesh Kant : ConcurrentLinkedQueue is infact a very superior implementation as it employs an efficient "wait-free" algorithm
ravi: i am getting request.getSession and adding these collections. so i think this collection will exist for that user only, session object take care i guess.
ravi: now the issue is with multiple same window with ctrl+n by same user.