• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX:about the lockcookie

 
janvy wei
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,all
my assignment is B&C constractor,and i have a question about the
instructions. thanks in advance
whether the lockcookie is unique for the client that's to say every client has a fixed lockcookie?
 
George Marinkovich
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Janvy,
Originally posted by janvy wei:
whether the lockcookie is unique for the client that's to say every client has a fixed lockcookie?

That is your design decision. However, if the lock cookie is not unique for each particular client, how then will you enforce the requirement that only the client who locks a particular record can unlock that record?
Hope this helps,
George
 
janvy wei
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
george,thanks your help once again.
i am also inclined to make the lockcookie unique for each particular
client,and there must be a mechanism to guarantee that when every time
the server restart,the client connecting to it will get the same
cookie,may be using persistence or something else.is it right?
but i noted that many javarancher generate the lockcookie with
"System.currentTimeMillis()" and say nothing about persistence.
could anybody give me some advice about this?
 
Jacques Bosch
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See http://www.coderanch.com/t/184895/java-developer-SCJD/certification/NX-lockCookie-generation
 
George Marinkovich
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Janvy,
Originally posted by janvy wei:
i am also inclined to make the lockcookie unique for each particular
client,and there must be a mechanism to guarantee that when every time
the server restart,the client connecting to it will get the same
cookie,may be using persistence or something else.is it right?

The lock cookie should be unique for each particular client for a particular run of the client. That is, I don't think there's any reason to persist the lock cookie for a client. One thing you would gain by persisting the lock cookie is that it would allow a client to lock a record, restart the application, and unlock the record. That doesn't seem important enough to me to justify the extra work of persisting the lock cookie for a particular client.
Hope this helps,
George
[ February 05, 2004: Message edited by: George Marinkovich ]
 
janvy wei
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,jacques,thanks for your reply,while i don't think your thread
answers my question.
hi,george,thanks again
One thing you would gain by persisting the lock cookie is that it would allow a client to lock a record, restart the application, and unlock the record.

persisting the lockcookie do be for the sake of this case above.
you don't think it would happen?it's a robustness issue.
 
George Marinkovich
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Janvy,
Originally posted by janvy wei:
...persisting the lockcookie do be for the sake of this case above.
you don't think it would happen?it's a robustness issue.

Well, I think it could happen. But I also think persisting the lock cookie so that the application would handle it robustly is beyond the scope of the project. So while I can see some benefit, it wouldn't be something I would (or did) implement.
Hope this helps,
George
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic