dhirendra singh

Greenhorn
+ Follow
since Oct 31, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by dhirendra singh

Please see Jeff Holms topic 'Passed scjd'
REGARDS
Rahul,
Thanks for detailed reply. I have probably got a hang of half of it. What I understood is, that, for lock() I need to write -
void lock(){
synchronized(record){
//all the operations for atomic booking, eg, read(record),
//modify(record) etc.
}
}
However, I still do not understand unlock().
I mean lock() method uses 'synchronized' keyword to lock a record. How do I 'unlock()' a record?(1. There is no 'unsynchronized' key word. 2. Won't the lock automatically get released after lock() method has executed fully?)
Please clarify.
Thanks.
Dear Jeff,
I have an elementary question on lock/unlock.
As almost all methods in the Data class are synchronized, calling any of these synchronized method would put a lock on the Data instance. The lock would be released once the synchronized method has returned(which is equivalent to unlock). Then why use the methods lock() and unlock() specifically. And even if one uses lock() and unlock() what kind of coding will be written.
Further, say, lock() has been written. What is the need of unlock(). I suppose, once the code of lock() has executed the record automatically gets unlocked.
I fear I am missing something. Please explain in as much detail as possible.
TIA for your help.
Dear Vin,
I have an elementary question on lock/unlock.
As almost all methods in the Data class are synchronized, calling any of these synchronized method would put a lock on the Data instance. The lock would be released once the synchronized method has returned(which is equivalent to unlock). Then why use the methods lock() and unlock() specifically. And even if one uses lock() and unlock() what kind of coding will be written.
Further, say, lock() has been written. What is the need of unlock(). I suppose, once the code of lock() has executed the instance is automatically gets unlocked.
I fear I am missing something. Please explain in as much detail as possible.
TIA in advance.
Hi, Rahul !
Am also preparing for SCJD. You can reach me on dsingh@ndf.vsnl.net.in.
Thanks and regards.

Originally posted by Rahul Sri2K3377:
Hi,
Is there anybody from Delhi or nearby (Gurgaon,Faridabad,Noida) preparing for Java Developer Exam??.
Rahul


Hi Rahul,
Just saw your posting.
I am in New Delhi. Am also working towards SCJD. Lets get in touch to make the best of it. Regds.
Dhirendra

Originally posted by Rahul Sri2K3377:
Hi,
Is there anybody from Delhi or nearby (Gurgaon,Faridabad,Noida) preparing for Java Developer Exam??.
Rahul