• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Locking & JDK5

 
Daniel Travin
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Is it allowed to use java.util.concurrent package in the assignment ?
I have no direct instructions that I must not use this package in my code.
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I think it is allowed but that it's not a big help..
I saw this topic before on this board and I think people were agreeing that it was not really usefull.

just do a quick search on this board!

Regards,
Alex
 
R van Vliet
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

It is allowed, but depending on your needs not always that useful as Alex said. The Lock class has some features that may be useful, but other than that I cant think of any class in the concurrent package that will simplify the SCJD assignment. I personally only used ReentrantLock for my lock manager, the other places where synchronization was needed I used synchronize blocks.

I suppose it's a bit of a taste matter as well. I like code using Lock objects rather than synchronized blocks because it's potentially more flexible and the code is more clear (but slightly more verbose as well). Also, the usage pattern is a bit different :



versus


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic