In the application I’m writing for work, we use a third-party application that has a Java API wrapping native code (using JNI). Under certain circumstances, one of the methods in the third-party application has a problem. However, it doesn’t throw an exception back to the calling code. Instead, it displays an exception dialog and kills the thread. This is really bad for my application, because it has resource management wrapped around the failing method, and the resource cleanup never happens, forcing the user to restart the application.
Is there any way to received notification that a thread has died? Is there any way to be notified that a JNI method never finishes? I’ve read a lot of JNI tutorials, and they all basically say not to do what this app does to avoid this situation. However, none say what to do if you’re stuck with it.