Hi :-) is the following possible? if it is wrong, please don't
laugh... //haha :-)
*
- being similar with HttpSession, make a "AsyncServletSession":
it will:
0 remember the current HttpServletRequest and HttpServletResponse
1 start a "TimeEatingProcessing"
2 release the current Servlet thread
3 after the "TimeEatingProcessing" is finished, it starts another Servlet
thread and response to the original client; the client don't know all
this: the client just wait there.
- and make a "AsyncServletable" interface for callback, it
defines a method which is use for "TimeEatingProcessing", and
when this method is being invoked, that Servlet thread can be
re-put back into the thread pool and/or be reused.
public interface AsyncServletable{
public abstract void doTimeEatingWrok();
}
* the code will be like the following:
public class MyServlet extends HttpServlet
implement AsyncServletable{
...
public void service(...) ...{
//make/get a AsyncServletSession
AsyncServletSession ars=req.getAsyncServletSession(true);
ars.rememberCurrentStatus(request, response);
ars.startAsyncProcess(this);
...
//begin to do a TimeEating work, and don't reply to client: client
//is waiting there
ars.askClientToWait(response);
//"release" the current thread
ars.releaseThisThread();
}
...
public void doTimeEatingWrok(){
//do a TimeEating work, for example, serch a database...
}
...
}
* but I think HttpSession can be across multi server", but
perhaps the above "AsyncServletSession" can not do it:
because I guess the "underlying TCP socket" can not be
"redirected" to another server, or is it possible? thanks
in advance! :-)
Bo
Mar.06, 2001
___________________________________________________________________________
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