Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

What is a lockCookie??  RSS feed

 
Jakub Drzazga
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I hope somebody will give me what is a lockCookie and how should I use it.
 
Jethro Borsje
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A lock cookie should be used to check if the Thread that accesses a certain record hold the lock to that record. In your lock() method you should generate such a cookie, you could use System.nanoTime() for this (for example).
 
Alecsandru Cocarla
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of "Thread", read "Client", in the previous post.
 
Jethro Borsje
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you are right, a lock cookie is used by a client.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!