Saturday 15 March 2014

Hai Friends, Today we would learn regarding Inter Thread Process Communication

Inter Thread Process Communication

One Thread Communicate with another thread inorder to avoid dead locks.

1. wait
2. notify or notifyAll

1.wait

To call wait(), notify(), notifyAll() the current thread should be owner of the object.

* We can call these methods only from synchronized block.

* If we call these method from non synchronized block then compiler give IllegelMonitorStateException.

* After calling wait method, the thread releases lock and enter into waiting state.

* After giving the notification by notify() the thread not release the lock.

* The only case lock is released is wait method.

No comments:

Post a Comment