I have a c library which i am using in my application on various platforms. Currently, I am planning to develop a web service using same c library using JNI. I will host this webservice using some application server (planning to use weblogic on linux PCs).
Does any one has experience of using native code on java server. Is this approach efficient. will i face any p开发者_开发百科roblems in future?.
General rule of thumb is to keep your logic inside native code, and avoid multiple jni calls (which generally cost much in terms of performance, more than having the same logic implemented only in java). But as always it depends greatly on your design and bottlenecks you have (io, cpu, network etc.). Hope this helps.
I am using a native JNI API with Glassfish. The biggest problem is if the C code crashes the entire application server dies immediately, no graceful termination, stack trace, or anything.
I would keep as little on the C side as possible, since Java will be much easier to work with. If you have performance issues then optimize later.
精彩评论