Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
So calls to lock and unlock method should be not included in the update or delete method.
throwing a RNFE from the unlock-method after deleting a record would be a bit stupid. But you need to call the unlock-method, because otherwise the record would be locked forever and what if another thread is also waiting on this deleted record. The application would never run to completion.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Anayonkar Shivalkar wrote:Why so? For update method, I guess there must be a lock (otherwise we'll have same problem of two threads updating same record etc.)
Anayonkar Shivalkar wrote:simply remove the entry of lock info of deleted record from the map.
Anayonkar Shivalkar wrote:I've used master-lock (a simple static lock)
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
(i think this is what 'thin client' does mean, right?)
3) If lock cannot be obtained on a record, there will simply be a message stating that record is already locked (or record does not exist; whatever applicable)
"Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU, consuming no CPU cycles until the desired resource becomes available."
That's against a must requirement, so that means automatic failure!
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Anayonkar Shivalkar wrote:Is this OK? Or should I move this code to business level (i.e. wait till record is locked, and then call lock method)
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
You don't know me, but I've been looking all over the world for. Thanks to the help from this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|