Why not construct the servlet to send feedback to the user on the progress of
the request, along the lines of a percent bar. That way, if the user 'stops'
the request, your servlet will discover this the next time it tries to write
the progress report. At that time you can handle the IOException and stop the
query in the exception handler.
Ed.
"PATIBANDA, SRIKANTH" wrote:
> hi,
>
> I have question regarding same thing that u guys are discussing.
> I know servlets are multithreaded by default.
>
> Scenario 1:(the request is trying to retrieve 5 rows out of some 500,000
> rows in the database.)
>
> lets say a user sends dopost request to servlet.. a thread is created..
> and user is waiting for a response.... Meanwhile user clicked the stop
> button
> on the browser...(I mention here its the browser button) it means from
> the user side the request has been cancelled..
>
> But if you check the JavaWebServer, the thread is still hanging out
> there...
>
> (you can know whether this thread is still going on or not at
> admin applet-->manage-->monitor-->resourceusage-->start view
> you can see under handler threads total---> avaialble...)
>
> my question comes here.. when does this thread die... or it will be there
> till it completes
> the request...
> or
> is there any other way to kill this thread...
>
> Reason for this to be killed or stopped is: it slowing the javawebserver
> drastically. I can not make another request
> till this thread dies or stops.
>
> please help me out with this...
>
> -srikanth patibanda
>
> -----Original Message-----
> From: Steven J. Owens [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 27, 1999 11:27 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Multithreading servlet
>
> Antoni asks:
>
> > someone kwon where I can get an example of Multithread Servlet?
>
> All servlets are multithreaded by default. For each request that
> comes in via HTTP, the servlet engine starts a new thread and the new
> thread invokes the servlet.
>
> This raises concerns about making any complex servlet code
> thread-safe, which means that if you have any persistent information
> that the servlet changes, you need to make sure it can't be changed by
> two threads, started by two different servlet invocations, at the same
> time. Most of the nuances of multithreading for servlets are the same
> as for any java program, and are covered by the usual discussions of
> multithreading.
>
> The servlet API has special built-in support for servlet
> sesssions that you can use to help manage persistent information. You
> get the session object by invoking HttpServletRequst.getSession().
> Look in the usual sources (the servlet spec, the Sun servlet tutorial
> which somebody else in this thread posted a link to, the purple-tech
> servlet faq likewise, or your handy dandy _Java Servlet Programming_
> by Jason Hunter, etc).
>
> Steven J. Owens
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
>
> ___________________________________________________________________________
> 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