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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Locking issues" Watch "Locking issues" New topic
Author

Locking issues

dhana sekar
Greenhorn

Joined: Feb 25, 2002
Posts: 21
Dear All,

According to my knowledge i feel the locking flow is as follows
lock -> read -> modify -> unlock
in the above flow, Can i have read, modify in the
same method.

-Dhana
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Dhana,
Hey dude you need to change your display name to a first and last name if you want to keep getting help from this most excellant forum.

in the above flow, Can i have read, modify in the
same method.

Absolutely. Why not do it all (lock, read, modify unlock) in a method named doBooking()?
Hope this helps
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Ditto
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
dhana sekar
Greenhorn

Joined: Feb 25, 2002
Posts: 21
Thanks a lot for ur immediate responce Mr.Morris & Mr.Mark.
What i mean is instred of having seperate
method like read(int recNo), modify(int recNo ) like lock() and unlock() can i have a common method named modifyRec(int recNo,int seat) which will first do reading followed by modifying. Please give ur comments and feedback on this.
-regards,
dhana
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

modifyRec(int recNo,int seat)

Isn't that saying the same thing that Micheal just said in his doBooking method.
Yes you will have a method like this, but not directly in the Data class. This will be in a DataAccessFacade type design pattern, for the client.
And please change your name to your first and last name. This is a policy of Javaranch, and you have been asked a few times already.
Mark
[ March 29, 2002: Message edited by: Mark Spritzler ]
dhana sekar
Greenhorn

Joined: Feb 25, 2002
Posts: 21
Iam very sorry for not changing my name. Any how now i changed it as u guys said.
-dhana
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Locking issues
 
Similar Threads
lock while reading data?
locking within modify
Doubt regarding locking & unlocking
add, delete and modify
Hopefully my final design, comments welcome