aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Why lockCookie is long? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Why lockCookie is long?" Watch "Why lockCookie is long?" New topic
Author

Why lockCookie is long?

Zhixiong Pan
Ranch Hand

Joined: Jan 25, 2006
Posts: 239
Hi ranchers,
I have a very simple quesion.That is in urlyBird the lockCookie is long type, why? And does lockCookie equal to cookie?


SCJP 1.4 SCJD
Eiji Seki
Ranch Hand

Joined: Feb 15, 2006
Posts: 88
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.


SCJD URLyBird (WIP)<br />SCJP 1.5
Zhixiong Pan
Ranch Hand

Joined: Jan 25, 2006
Posts: 239
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

Joined: Feb 15, 2006
Posts: 88
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

Joined: Feb 15, 2006
Posts: 88
Oops, no no, magic cookies also make sense when identifing different threads that are trying to lock/unlock some record.
 
Consider Paul's rocket mass heater.
 
subject: Why lockCookie is long?