Exception/Error handling with JNI
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Kris_Kegel
Posted On:   Monday, October 31, 2005 10:31 AM

Hi, We have a fairly large C++ dll and lib that are giving us some trouble. We are using JNI to get a hold of some complex methods in the C++ dll that help us do some large mappings. The problem is that in some very rare occasions the C++ dll throws an unhandled exception/error that causes our entire program to terminate. This happens less than 0.001% of the time, but never the less ruins the complete mapping of 200GB+ of data (which takes time...). The question is then: Is there a way to insure that errors happing outside our java code will not cause the program to terminate? Perhaps some fancy try-catch look-alike? Thanks for any help you can provide.    More>>

Hi,



We have a fairly large C++ dll and lib that are giving us some trouble. We are using JNI to get a hold of some complex methods in the C++ dll that help us do some large mappings.



The problem is that in some very rare occasions the C++ dll throws an unhandled exception/error that causes our entire program to terminate. This happens less than 0.001% of the time, but never the less ruins the complete mapping of 200GB+ of data (which takes time...).



The question is then: Is there a way to insure that errors happing outside our java code will not cause the program to terminate? Perhaps some fancy try-catch look-alike?



Thanks for any help you can provide.



The best regards


Kris Kegel

   <<Less

Re: Exception/Error handling with JNI

Posted By:   Christopher_Koenigsberg  
Posted On:   Sunday, November 6, 2005 05:12 PM

Perhaps you need to try a periodic checkpoint, where you save the current state. Then if the thing crashes you can restart from the most recent checkpoint, instead of starting over from the beginning.



Otherwise consider getting rid of native code (e.g. the C++) and just using Java, I guess. Or, learn about signal handlers in C/C++, and prepare for some messy coding/testing/debugging on that.


About | Sitemap | Contact