|
Synchronization Of Threads
|
|
03-03-2008, 03:36 PM
Post: #1
|
|||
|
|||
|
Synchronization Of Threads
How sychronized keyword works with static method &non-static methods?????
Please refer a good book regarding Networking(i.e.Sockets,RMI,etc..)[/font] |
|||
|
03-03-2008, 11:30 PM
Post: #2
|
|||
|
|||
|
RE: Synchronization Of Threads
Both are synchronized methods. Method with static modifier is a class method ie, only one static synchronized method in the class will be accessible at any point of time to the threads. A synchronized method automatically performs a lock action when it is invoked; its body is not executed until the lock action has successfully completed.
The method without static modifier is an instance method. If the method is an instance method, it locks the lock associated with the instance for which it was invoked (that is, the object that will be known as this during execution of the body of the method). |
|||
|
03-04-2008, 12:51 AM
Post: #3
|
|||
|
|||
|
RE: Synchronization Of Threads
In static synchronized we get the lock at the class level where in non static synchronized method we get the lock at the object level
|
|||
|
03-04-2008, 02:04 PM
Post: #4
|
|||
|
|||
|
RE: Synchronization Of Threads
I think Java Network Programming 3rd edition is one of the best book available for Java network programming.
|
|||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)





