This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

thread safe class

 
Shrawan Bhageria
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

Please let me know

How i make class thread Safe like Vector class.

Regards,

Sharwan
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi cowboys,


you have to synchronize all methods that manipulate members of that class.
But this is only a very brief answer, your question implies to much to be answered in a forum in my opinion.
Have a look at CHAPTER 17
Threads and Locks
of the language specification:
http://java.sun.com/docs/books/jls/second_edition/html/memory.doc.html#30206

Yours,
Bu.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic