In my application I have a wrapper over some native code, which is called via JNI bridge. This native code needs to be executed in separate thread (parallel processing). How
I won't repeat all precious advices given by Tudor.... I 'll just add an alternative architectural point of you while using any queing like mechanism to handle the communication between your main Java application and the native thread launched .... This thread may be client of a broker and being notified if some special events occur (termination) and acts in consequence (stopping long running job) Of course this adds some complexity but is a quite elegant solution .. Of course if the native thread is not robust it won't change anything to the whole robustness.. One way to handle communication between native thread and a broker would be to use a STOMP like interface (many brokers Apache activemq, MQ from Oracle expose such interface) ...
HTH Jerome