Hi Sanjay,
U can make a jni call to the c++ funtion in one
servlet and keep this servlet as a reference servlet
.when u need to acess this c++ funtion again in your
other servlet which are part of the same
web-application u jst use RequestDispatcher object and
give a call to the reference servlet.Meaning
use
getServletContext().getRequestDispatcher().include("referenceServletName").This
would suffice ur need I believe.
Rishi
--- sanjay <[EMAIL PROTECTED]> wrote:
> Hi Kaustubh,
>
> Thank you very much for the info. But there
> are some issues.
> Imagine I have declared a variable in first servlet
> and instanciated in
> the init method.
> but when I try to use that variable in the second
> servlet, it would give
> me a compile time error saying that variable is
> undefined.
>
> Secondly I need the request and response object for
> the JNI function
> (which i intend to call in init() method) and which
> is not available in
> the init() method.
> If you need any more explanation on this pl mail me.
>
> Kindly help
> Regards,
> San.
>
> Kaustubh wrote:
>
> > Dear Sanjay,
> > Once u declare an Instance variable in a servlet,
> it is shared among all the
> > servlet threads in a multi-threaded model.
> > So declare it as an instance variable and
> initialize it in the init()
> > method.
> > See if it helps.
> > Actually I had tried it using a simple int
> variable and it gets shared among
> > all the servlet threads without making it static.
> > Pls. let me know if this is not the case.
> > Kau.
> >
> > ----- Original Message -----
> > From: "sanjay" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, January 11, 2002 11:17 AM
> > Subject: Servlet performance
> >
> > > Hi all,
> > > I am using servlets with JNI .
> > > I am currently using a JNI function which is
> being called by most of my
> > > servlets.This call is made from servlet to
> fetch data from C++
> > > domain,which is collected into many arrays which
> are declared as public
> > > member variables of my servlet. Is there any
> method to avoid calling
> > > this JNI function in every other servlet and
> instead have a single call
> > > made only in one servlet, but without using
> static variables to store
> > > the values fetched ?
> > >
> > >
> > > This is basically to avoid increase of memory
> utilised .What I observed
> > > is that every access to a servlet increases
> memory by a certain amount
> > > (100KB), which eventually builds up to 50MB and
> later gets garbage
> > > collected ,down to 16 MB.I am using Tomcat
> version 3.2.1. , operating on
> > > windows NT.
> > >
> > > Kindly Help!!!!
> > > Regards
> > > San.
> > >
> > >
> >
>
___________________________________________________________________________
> > > To unsubscribe, send email to
> [EMAIL PROTECTED] and include in the
> > body
> > > of the message "signoff SERVLET-INTEREST".
> > >
> > > Archives:
>
http://archives.java.sun.com/archives/servlet-interest.html
> > > Resources:
>
http://java.sun.com/products/servlet/external-resources.html
> > > LISTSERV Help:
> http://www.lsoft.com/manuals/user/user.html
> > >
> > >
> >
> >
>
___________________________________________________________________________
> > To unsubscribe, send email to
> [EMAIL PROTECTED] and include in the body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives:
>
http://archives.java.sun.com/archives/servlet-interest.html
> > Resources:
>
http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help:
> http://www.lsoft.com/manuals/user/user.html
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED]
> and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives:
>
http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
>
http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help:
> http://www.lsoft.com/manuals/user/user.html
>
__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html