Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Locking...

 
Anton Golovin
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, friends.

There are lots of questions on locking, I think, and I think it is appropriate to point people to the most approapriate solution looked for by Sun in the scope of their requirements of "wasting no cycles"...

People familiar with this concept will know that wasting no cycles does in fact mean that the notifyAll() method does not fit this requirement. (I used this method, however, and got 72/80 on locking, which could be due to other mistakes...) However, if they penalize people for it or not, notifyAll() still does waste cycles.

The only way to do it is to use monitor objects in a queue and sequentially call notify() on them.

There is a second part to locking. It is unlocking. Make sure that a record is always unlocked after it is locked - even if something fails.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic