Two Laptop Bag*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes About locking issue, how to store cookies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "About locking issue, how to store cookies" Watch "About locking issue, how to store cookies" New topic

About locking issue, how to store cookies

Chih-Wei Lee
Ranch Hand

Joined: Feb 20, 2008
Posts: 129
I am on the point of implementing lock and unlock method. My question is how most people store cookies with record.
I have two ways to do it.
1. I have a object class called Contractor. This object store the information about one record. So I can add a property called cookie to adhere this object. So when someone locks this record, he updates this property and unlock this record by updating this property to 0.

2. Using a Map collection to store cookie, like <Key: recNo, Value: cookie>
If record is unlocked, it sets value as null or 0.

Can someone give me suggestion that which one is better?
I worry about the synchronize problem.



It is sorta covered in the JavaRanch Style Guide.
subject: About locking issue, how to store cookies
Similar Threads
NX: a little more locking don't do no harm...
NX: lockCookie
Question regarding Design
Clarification of the lock mechanism.
NX: URLy Bird 1.3.1 Hashmap (or Hashtable)