Hello, I'm running a servlet which does some internal operations using much resources when a request is send. I have two problems: first, when someone clicks several times it sends several requests which can make the system busy for a long time, and second, if the session is closed (browser closed) or the operation is aborted on the client side, the servlet will continue to perform actions and sometimes block other users. So how can I : - block several clicks from the same client. - test client's existence. - How can I declare the classes used in the operations so they can be heavily interrupted by the servlet if client's session is closed... Eternal Thanks to persons who can offer some help!
Joined: Nov 18, 2003
Thanks for the interest. The problem is: I display a list of links to my servlet, and each one generates a request that makes a document to be scanned, indexed, and this index being compared to a (sometimes huge) index object loaded in memory. Thinking of it, the problems to disable multiple clicks and testing client existence are not so important because I can avoid them by aborting past requests before every new one (a client can abort a request by clicking on another link) or by sending a query to servlet if window is closed. I'm beginning to make my thread separate... so I have to make another Runnable object to control it? how does this object work? Thx.
Author and all-around good cowpoke
Joined: Mar 22, 2000
There have been a number of discussions here about using separate threads for long-running processes. Some searches will probably find them. If you are just now learning about the Thread class and the Runnable interface, you should probably work in an environment that is simpler than a servlet until you have the essential functions working. Bill