Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Locking

 
Mike Yu
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Max,
In your book, you synchronized the lock on a Vector object. What are the differences if I synchronize on the methods?
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Max,
One more question: Why did you used Vector instead of ArrayList in your book? There is no need for it since you synchronize access to on reservedDVDs.
Just because a junior programmer is more familiar with Vector ?
Tx,
Vlad
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd stick with the ArrayList. It is the preferred Collection to use over Vector.
Mark
 
Mike Yu
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Max,
How about HashMap?
Also can you answer my question at the beginning of this thread?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic