Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > how do you call a c library in a web services?

Reply
Thread Tools

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

 
 
tak
Guest
Posts: n/a
 
      08-29-2006
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

 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Arne_Vajh=F8j?=
Guest
Posts: n/a
 
      08-29-2006
tak wrote:
> 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
 
Reply With Quote
 
 
 
 
Chris Uppal
Guest
Posts: n/a
 
      08-30-2006
tak wrote:

> 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


 
Reply With Quote
 
tak
Guest
Posts: n/a
 
      08-30-2006

Chris Uppal wrote:
> tak wrote:
>
> > 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


Thanks to both arne and chris.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
System call and library call leoman730 C++ 6 05-06-2007 12:37 AM
system call and library call rahul8143@gmail.com C Programming 7 08-23-2005 01:24 PM
Re: Difference between Web Control Library and Class Library Alan Ferrandiz [MCT] ASP .Net 0 09-11-2004 01:51 PM
Re: Difference between Web Control Library and Class Library Mythran ASP .Net 0 08-24-2004 05:53 PM



Advertisments