aspose file tools*
The moose likes Servlets and the fly likes priorities in Servlet 2.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "priorities in Servlet 2.3" Watch "priorities in Servlet 2.3" New topic
Author

priorities in Servlet 2.3

Sundar Gopal
Greenhorn

Joined: Jun 20, 2003
Posts: 17
i have a servlet which will take atleast 5 mins to complete the service() method(imagine) due to some complex EIS query. i need to know one thing that if i set my session timeout period to say 1 minute and i enter the servlet what priority i will be getting. that is since i am yet to get the response from the server, my session will be active or since the time taken to cater my request takes more than the session time out interval, so my session will be getting invalidated.


Regards,<br />SundarGopal.<br />Scjp, Scwcd, Scbcd.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12671
    
    5
i need to know one thing that if i set my session timeout period to say 1 minute and i enter the servlet what priority i will be getting.

Session timeout has nothing whatsoever to do with Thread priority. Why would you want such a short timeout?
There have been a LARGE number of discussions here about how to handle time consuming queries gracefully in servlets - browse around in the last few weeks of posts.
Bill


Java Resources at www.wbrogden.com
Siyaa Hoffman
Greenhorn

Joined: Jan 15, 2004
Posts: 23
Is there some way that the results of your long query can be cached locally ?

In that case, you can load the servlet on start-up and the data from the long query can be cached locally so that the subsequent requests read it from the cache and do not take that long.

Also, see the following URL -
http://www.javaranch.com/newsletter/200403/AsynchronousProcessingFromServlets.html
[ June 04, 2004: Message edited by: Siyaa Hoffman ]
Sundar Gopal
Greenhorn

Joined: Jun 20, 2003
Posts: 17
thanks for your response. actually the query takes nearly 45 mins to complete and its differs according to the user. will it be possible to cache that all!!! thats why i need to know about the session timeout priorities. kindly help me if u have any suggestion to increase the query performance.
:roll:
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12671
    
    5
45 minutes is WAAYYYYY too long for a single request/response cycle and if the result is huge, storing it in the session is not appropriate. You will need to conduct the query in a separate Thread - maybe even a separate process, and provide some key in the session, or maybe in a longer-lived cookie for the user to retrieve the result later.
What format is the result in?
Bill
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15624
    
  15

Yah. Don't mistake the user's browser for a client/server client program. Web browsers are "hit-and-run". The user has no real idea what is happening when they hit Submit and nothing comes back for minutes at a time. For all they know, the server crashed.

I have a project where the backend can take literally hours. Among other things, this was holding the entire Tomcat server for ransom when I ran it in the Tomcat JVM. If some other process went south, we couldn't restart Tomcat without killing the backend engine as a side-effect.

Finally ended up making the engine a separate application altogether and used RMI from Tomcat to invoke it and query for run status.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: priorities in Servlet 2.3
 
Similar Threads
Dependency Injection Problem !!!
problem with getting result from session
Session Id Problem
session.isNew() is always returning false
Session Object