This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

synchronized collection wrapper classes?

 
Pal Sudarshan
Ranch Hand
Posts: 52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I have read, Collection classes are not synchronized. Therefore, using them in multithreaded programs may cause errors. That is the reason Sun designed syncrhonization wrappers for the Collections. I don't understand why there is a need for synchronized wrapper classes because don't programmers usually use data strucutres within methods, and if programmers make their methods synchronized, then there is no need for wrapper classes. My question, therefore is, why are there Collection wrapper classes?
 
Anthony Watson
Ranch Hand
Posts: 327
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not necessary to synchronize an entire method in a class you are writing just to have threadsafe access to a Collection. That is why there are Collections that have synchronized methods.
 
siva raju
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As i understand it, first we had synch. classes like vector and Hashtable. Because of performance issues, they later provided non-synch. collections like ArrayList and HashMap.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic