-
June 11th, 2011, 10:44 AM
#1
some java synchronization Questions?
1) what happens when we call the wait on synchronized method?Does it release the lock?
2)
Class{
synchronized(someObject) {
someObject.wait();
}
}
will above code release the lock on someObject once we someObject.wait() is called
Class{
synchronized(someObject) {
wait();
}
}
will it still release the lock on someObject once wait() is called
3) when a thread calls the unsynchronized method1 on object1 which internally calls synchronized method say method2 of same object then it gets the lock on
that object. but when that lock gets released . Does it happen as soon as that thread comes out of that synchronized method i.e method2 or method1?
4)I have seen usage of wait method mostly inside the synchronized method.Does not it make sense to use wait inside the method which is not synchronized?
5) Daemon threads are like a service providers for other threads or objects running in the same process as the daemon thread?
what does the same process mean here?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|