I just came across Thrift and recently started playing with JNI.
From what I understand, Thrift provides you with the tools to define interfaces between different languages (correct me if I am wrong). JNI seems to do a similar job, in my experience, between Java and C++.
I was wondering if I could use Thrift to do the tasks I am currently doing in JNI. If yes, for what tasks should I use Thrift, and when should I use JNI?
Thanks!
You should use thrift, or similar RPC library, when you are communicating between different processes. You can use JNI when passing method calls between Java and C in the same process. The cost of using thrift is approximately 10 - 100x higher than using JNI depending on what you doing which why you would only use it when you can't use JNI.