dcsimg
Threading issues with Servlets that causes the JVM instance started by Servlet Container to go out of memory
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Santosh_Joshi
Posted On:   Thursday, June 20, 2002 04:01 AM

In one of my HTML form served to the user, he may post data back which is actually a big data fetch (which takes definitive considerable time to fetch, say X seconds). User may get fed up and press the Data fetch button multiple times (say N times). I am using a JAVA Bean(User session scoped) which has a synchronized method for a data fetch. Hence each user click is queued up and the user gets response after X(seconds) times N(clicks), which can be in several minutes!! Since the data fetch is heavy on memory, if few users are doing this, then the JVM running this Servlet/Bean goes out of memory. My question is: "Is there any way of stopping the earlier user data fetched th   More>>


In one of my HTML form served to the user, he may post data back which is actually a big data fetch (which takes definitive considerable time to fetch, say X seconds).


User may get fed up and press the Data fetch button multiple times (say N times).


I am using a JAVA Bean(User session scoped) which has a synchronized method for a data fetch. Hence each user click is queued up and the user gets response after X(seconds) times N(clicks), which can be in several minutes!!


Since the data fetch is heavy on memory, if few users are doing this, then the JVM running this Servlet/Bean goes out of memory.


My question is: "Is there any way of stopping the earlier user data fetched threads?" Because even if these threads execute successfully they do not have any Output IO stream to write to anyway! It is only the last user click, which is going to count!


Please help, as this is causing a lot of concern to me or may be I am not analyzing the problem correctly

   <<Less

Re: Threading issues with Servlets that causes the JVM instance started by Servlet Container to go out of memory

Posted By:   Hans_Sczyrba  
Posted On:   Thursday, June 20, 2002 04:42 AM

The correct solution to the problem is to prevent the user from 'Submitting' their request more than once in the first place. This can be done with Javascript by either disabling the 'Submit' button or even hidding it once it has been pressed. This multi-click can become especially ugly when you're dealing with Credit Card transactions.
About | Sitemap | Contact