• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Who to treate lockCookie in URLyBird?

 
Zhixiong Pan
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,
When i planned to write update method, i confonted the lockCookie parameter. I only know that parameter refer to lock designing either in client or server.Here I show you the instruction from my assignment:

// Modifies the fields of a record. The new value for field n
// appears in data[n]. Throws SecurityException
// if the record is locked with a cookie other than lockCookie.
public void update(int recNo, String[] data, long lockCookie)
throws RecordNotFoundException, SecurityException;


What to do about lockCookie?I need your advices.
 
Arto Pastinen
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Isn't it against certification rules to ask that kind questions here?!?

- Artsi
 
Zhixiong Pan
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I so sorry for breaking the rule.If I just want to know what knowledge i should get to solve my problem, can you give me some advices?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Artsi,
Isn't it against certification rules to ask that kind questions here?!?
Nope. We have had (and continue to have) discussions with Sun as to what is appropriate on this site and what we are allowed to have in the various forums. Our understanding at this time is that these discussions are OK in the SCJD forum since, as developers, we would normally be expected to discuss problems with wording in projects, and discusss general techniques with other developers.

This is different from the SCEA forum, where the general concept is that architects are more likely to work alone on projects.

What we don't allow in this forum is having too much of a potential solution given away. So we dont allow large amounts of code to be posted, nor do we generally allow multiple methods of specific classes to be posted.

But Zhixiong's question is perfect for this forum (unfortunately I just got paged in the middle of this posting, or I would spend some time answering his question).

Regards, Andrew
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Zhixiong,

I think I answered this in another post to you but basically when your client wants to update a record, it must first call the lock method. This method will return a lock cookie to the client. The client must then pass this lock cookie as a parameter in the update and unlock methods. If the client does not pass the correct lock cookie then the update and unlock methods will not work (in fact they will probably through exceptions).

Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic