• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Catching all exceptions, thread safety issues, and safely closing a user session

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are currently using Tomcat web server for deploying our application. Most of the modules have a couple of huge reports (take about 30-60 minutes, because of hibernate) running in the background.

Whenever the user initiates the report method by clicking a button and then he accidentally clicks any other button to begin any other method, the tomcat server gets stuck and sometimes returns "Thread Safety Error" message.

1. How do we stop a running (a particular session) method in Tomcat by just a user click and 2. what is the best way to stop displaying or catching any kind of exceptions/errors from being displayed in the users display page? We even have many problems with a particular session not closing properly or at all, 3. safe way to close a hibernate session. Any comments or suggestions on these issues are appreciated.

Thanks
Rama

Thread Subject: Catching all exceptions, thread safety issues, and safely closing a user session
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like you already have a discussion going on related to this topic.
Frankly, I think you've made a poor choice of architecture (Tomcat) for your requirements (reports churning through huge amounts of data).
Tomcat is a servlet container. It is not designed to support long-running processes. As you've discovered, is way to easy for your users to violate the HTTP protocol by clicking on another link.
I'd be inclined to move the report functionality off into another application and have a light web application that submits report requests to that app. The report app can send users the reports via email or upload the report somewhere that Tomcat can access and include a URL to the report in the email.
 
Rama Krishna
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Joe,

I am still working on tuning our hibernate queries and have already been working on that issue. This is a totally different issue here.

"It looks like you already have a discussion going on related to this topic. Frankly, I think you've made a poor choice of architecture (Tomcat) for your requirements (reports churning through huge amounts of data).
"



Any suggestions on free to use servers for displaying or processing huge reports or database data? Anyways, we do not have much of a choice as we cannot afford and so lets assume that Tomcat is the server.

I'd be inclined to move the report functionality off into another application and have a light web application that submits report requests to that app. The report app can send users the reports via email or upload the report somewhere that Tomcat can access and include a URL to the report in the email."



We already implemented the email and FTP options, but I am sure that there are ways to stop this from happening. Anyways, any of the following issues were related to my previous post:

1. How do we stop a running (a particular session) method in Tomcat by just a user click and 2. what is the best way to stop displaying or catching any kind of exceptions/errors from being displayed in the users display page? We even have many problems with a particular session not closing properly or at all, 3. safe way to close a hibernate session, we had to comment out the session.close() or session.flush() in our method that returns the current session or that creates a new session for use.
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rama Krishna:

Any suggestions on free to use servers for displaying or processing huge reports or database data? Anyways, we do not have much of a choice as we cannot afford and so lets assume that Tomcat is the server.


Tomcat can handle the complex front end stuff (multiple simultaneous users, authentication). All you need is something to run reports. I've got many examples that are simple daemon processes, all of 200 lines of code, that read requests off a JMS queue and process them.

Originally posted by Rama Krishna:

1. How do we stop a running (a particular session) method in Tomcat by just a user click


You can't. HTTP is strictly request-response. There is no facility provided to interrupt a request once it is initiated.

Originally posted by Rama Krishna:

2. what is the best way to stop displaying or catching any kind of exceptions/errors from being displayed in the users display page?


You can isolate them with a catch-all try-catch block, but it is still good design to let the user know that something failed.

Originally posted by Rama Krishna:

3. safe way to close a hibernate session, we had to comment out the session.close() or session.flush() in our method that returns the current session or that creates a new session for use.


I am far from a hibernate expert, so you'd be best to ask this in the Hibernate forum. I've been using an interceptor like the example on page 54-55 of Ted Husted's Struts 2 from Square One and it works fine for my purposes.
 
Rama Krishna
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tomcat can handle the complex front end stuff (multiple simultaneous users, authentication). All you need is something to run reports. I've got many examples that are simple daemon processes, all of 200 lines of code, that read requests off a JMS queue and process them.



I know the basics of JMS but I am not sure how I can put any of the user's request and put in a queue and then process based on the requests.. Actually, I could not understand it at all..


I am far from a hibernate expert, so you'd be best to ask this in the Hibernate forum. I've been using an interceptor like the example on page 54-55 of Ted Husted's Struts 2 from Square One and it works fine for my purposes.



I was unable to download the interceptor or able to find an example as I could not get access to Ted Husted's Struts 2 book. Any suggestions where I can get I can access it easily?
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rama Krishna:
I was unable to download the interceptor or able to find an example as I could not get access to Ted Husted's Struts 2 book. Any suggestions where I can get I can access it easily?



Go to the site I linked to above and click on the link that says "Working Draft (PDF)".
 
reply
    Bookmark Topic Watch Topic
  • New Topic