Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why lockCookie is long?

 
Zhixiong Pan
Ranch Hand
Posts: 239
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,
I have a very simple quesion.That is in urlyBird the lockCookie is long type, why? And does lockCookie equal to cookie?
 
Eiji Seki
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The cookie is a long in order to allow more clients and to low the chances of collision when generating them.
A lockCookie is similiar to a web browser cookie, but it is not one.
 
Zhixiong Pan
Ranch Hand
Posts: 239
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have one more quesion.Is my lockCookie produced according to the recNo.That is to say, in my lock(int recNo), i should produce a lockCookie via recNo.
 
Eiji Seki
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have some reason for it, you may do so and document it in your choices.txt. But I see no relation between the two numbers. Also, there is no restriction that one seed is used for only one record. In fact, seeds and locks/unlocks outside read/create/update methods just make sense if you are dealing with multiple record locking.
 
Eiji Seki
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, no no, magic cookies also make sense when identifing different threads that are trying to lock/unlock some record.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic