Wednesday, May 23, 2012

Java wait(), notify()

Java Multithread wait(), notify() must know.

1. Object use to lock must be static, each object have it own wait().

2. Locked object must release by own monitor, e.g :

            public static Object lock = new Object();

                        synchronized(lock) {

            //on other thread

                synchronized(lock) {

No comments:

Post a Comment