Eclipse 3.7.2 is bugged in Solaris 11 X86 – its main thread randomly enters sleep state and never wakes up from it. I wish to interrupt the sleep so that the main thread will continue running. Is it possible?
More details here: Eclipse hangs forever, thread dump says main thread is sleeping
I don’t think it’s a great idea to interrupt threads which are running code that you didn’t write — you could possibly cause deadlocks, corrupt data structures, etc. Or it could possibly be benign. But that’s your risk…
Yes, it is possible to do what you want. If you can get some of your own code running within that application, then you can monitor the threads until you see a thread which has a specific name and been sleeping for a long time, and interrupt it, pretty easily with:
To get your code to run at the same time as the rest of the program, you can modify the launcher: modify the classpath, create a class with a main method which starts your own monitoring thread and then calls the real main method.
Alternatively you could write your monitoring thread as a Java agent and use the “-javaagent” switch. See http://docs.oracle.com/javase/7/docs/api/java/lang/instrument/package-summary.html for more information.