Hi all,
The problem I'm trying to fix is this: a low-priority thread A calls object1.notify(), but a high-priority thread B, which should be waiting on object1, does not wake up. The code can work without a hitch for days and then thread B will stop waking up.
I see two possible causes:
1) some other thread C was also waiting for object1 and notify() starts waking up that thread.
2) something to do with priorities
I'd like to find out what's happening... Is there a way to find out programmatically which thread owns the object's monitor? I.e. generating a thread dump from console, for example by sending a QUIT signal on Unix, which gives some information about locking and otherwise might answer the question, won't work here.
I can get all the threads, their states and stack traces using the methods in Thread that were added in release 1.5, namely getState() and getAllStackTraces(). But what about monitors?
Thanks in advance for your help.
The problem I'm trying to fix is this: a low-priority thread A calls object1.notify(), but a high-priority thread B, which should be waiting on object1, does not wake up. The code can work without a hitch for days and then thread B will stop waking up.
I see two possible causes:
1) some other thread C was also waiting for object1 and notify() starts waking up that thread.
2) something to do with priorities
I'd like to find out what's happening... Is there a way to find out programmatically which thread owns the object's monitor? I.e. generating a thread dump from console, for example by sending a QUIT signal on Unix, which gives some information about locking and otherwise might answer the question, won't work here.
I can get all the threads, their states and stack traces using the methods in Thread that were added in release 1.5, namely getState() and getAllStackTraces(). But what about monitors?
Thanks in advance for your help.
