how do you call a c library in a web services?

T

tak

Hi,

Say i have a c library that i need to call in a java web service. Do I
do it the same way in a standalone app? Will that slow down performance
of the ws itself?

Thansk,
T
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

tak said:
Say i have a c library that i need to call in a java web service. Do I
do it the same way in a standalone app? Will that slow down performance
of the ws itself?

Yes.

The absolute overhead in the JNI invocation should not be that big
but the relative overhead depend on how much is actually done
in Java and C.

Arne
 
C

Chris Uppal

tak said:
Say i have a c library that i need to call in a java web service. Do I
do it the same way in a standalone app? Will that slow down performance
of the ws itself?

Adding to Arne's reply...

If you are writing JNI code to be run from a classloader-aware application
(such as I imagine most webservice containers are) then you'll have to be a
little careful about which classloader loads the class with the native code. A
class can normally be loaded by several independent classloaders, but not if it
uses JNI since the external library (DLL, .so, whatever) cannot be shared. So
you may have to ensure that the class with the native code is in the shared
part of the overall server, rather than being specific to one application
running in it.

-- chris
 
T

tak

Chris said:
Adding to Arne's reply...

If you are writing JNI code to be run from a classloader-aware application
(such as I imagine most webservice containers are) then you'll have to be a
little careful about which classloader loads the class with the native code. A
class can normally be loaded by several independent classloaders, but not if it
uses JNI since the external library (DLL, .so, whatever) cannot be shared. So
you may have to ensure that the class with the native code is in the shared
part of the overall server, rather than being specific to one application
running in it.

-- chris

Thanks to both arne and chris.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top