IllegalMonitorStateException on 'object.wait()' call randomly

by svd » Fri, 23 Apr 2010 08:04:51 GMT

Sponsored Links
 My code throws an IllegalMonitorStateException on 'object.wait()'
call, even though wait is invoked inside a synchronized block. And
this exception occurs only randomly not always.

below is my code snippet:

while (!mFinish) {
          synchronized (mResponse) {
                    if (!mResponse.isEmpty()) {
                           do something
                    } else {
                        try {
                        } catch (InterruptedException ie) {


Also all the 'notify' methods are in synchronized block.
Please point out if there is anything wrong in my code?


Other Threads

1. Listview allocates too many objects

I have an activity with simple ListView with about 2500 items, a
SimpleCursorAdapter i used to populate the view. Each item of the list
view contains about 5-6 simple widgets everything is pretty standard
for now but  when i start scrolling the ListView i got this on the
11-03 14:31:49.239: DEBUG/dalvikvm(5186): GC freed 3668 objects /
251256 bytes in 142ms
11-03 14:31:52.579: DEBUG/dalvikvm(5186): GC freed 17812 objects /
1003384 bytes in 157ms
11-03 14:31:54.409: DEBUG/dalvikvm(5186): GC freed 11069 objects /
527288 bytes in 134ms
11-03 14:31:56.359: DEBUG/dalvikvm(5186): GC freed 10988 objects /
524432 bytes in 139ms
11-03 14:31:57.629: DEBUG/dalvikvm(5186): GC freed 10952 objects /
523896 bytes in 134ms
11-03 14:32:00.419: DEBUG/dalvikvm(5186): GC freed 10967 objects /
524120 bytes in 131ms
11-03 14:32:02.699: DEBUG/dalvikvm(5186): GC freed 10976 objects /
524016 bytes in 138ms
11-03 14:32:13.619: DEBUG/dalvikvm(5186): GC freed 10977 objects /
524880 bytes in 131ms
and so on and so on until i don't stop scrolling. Is this a normal
situation or i am getting something wrong ?


2. Display APIs in Android?

Hii All

Can anybody please tell me how can we display a buffer on screen?

Currently I create a bitmap using Bitmap's CreateBitmap() and render
it on screen using canvas' drawBitmap().

Is there any other way of doing this in Java layer?

Please do share your thoughts.

thanks in advance


3. Quick Contacts popup

4. Manage the Wifi connection from an applicacion

5. Wifi does not automatically connect after boot

6. How to get all the log from phone reboot to IDLE

7. Problem download source code in linux (ubuntu 8.04)