I am new at using JNI. I successfully write a few programs that call native methods written in c.
Now I need my java code to be called by the native code side after it is initialized. Is it possible?
Until now, I tried some kind of polling techniques. That is, I check native code parameters from my java code periodically, but if there is a way that native code can send some kind of interrupt it could be more efficient. Is it possible? Or can you suggest a better way than polling?
Note:
When I search for "Call Java Functions from C Using JNI" all the answers I get is like
http://www.codeproject.com/Articles/22881/How-to-Call-Java-Functions-from-C-Using-JNI
JNI Call java method from c program
Those examples is not an answer for my situation. Because my main program is in java, and what I ask is that: Can the native functions(written in c) that I call from java code call some other java functions under certain circumstances? Is it possible to manage this without using a polling technique like I mentioned above?