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

Discussion in 'Java' started by tak, Aug 29, 2006.

  1. tak

    tak Guest

    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
    tak, Aug 29, 2006
    #1
    1. Advertising

  2. 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
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Aug 30, 2006
    #2
    1. Advertising

  3. tak

    Chris Uppal Guest

    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
    Chris Uppal, Aug 30, 2006
    #3
  4. tak

    tak Guest

    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.
    tak, Aug 30, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nick
    Replies:
    1
    Views:
    6,103
    Alvin Bruney - ASP.NET MVP
    Sep 12, 2005
  2. Anup
    Replies:
    1
    Views:
    2,763
    Mark Rae
    May 9, 2006
  3. imlakhani

    Web Services Restful Services

    imlakhani, Dec 16, 2009, in forum: Java
    Replies:
    1
    Views:
    411
    Jeffrey H. Coffield
    Dec 16, 2009
  4. paul
    Replies:
    2
    Views:
    118
  5. John
    Replies:
    4
    Views:
    413
Loading...

Share This Page