> -----Original Message----- > From: Yves Sy [mailto:[EMAIL PROTECTED] > > > Here's a follow-up question: > > I remember creating a thread in one of my Action classes because I > needed to show a "Wait while your request is being processed..." page. > > The flow goes something like: > 1. the MAIN thread returns an ActionForward right away that > contains the "processing" page; > 2. the NEW thread I created goes ahead and makes the back-end call > that takes a considerable amount of time to process; > 3. After NEW thread returns with the results, it sets a flag in > the session that it's done with the processing; > 4. Meanwhile, the processing page keeps refreshing itself and > sending execution to an action which checks for the session flag set > in #3; > 5. When it finally finds the session flag, it forwards > to the results page. > > Its working fine for me. No weird behavior on Weblogic or SAP WAS. > Although now I'm curious: Is there a better way to approach this > problem? > > Regards, > -Yves-
As others have noted JMS is one way of handling asynchronous processing. You can think of it as glorified publish and subscribe / observer and observee, since only an instruction is being passed. What you describe is one of the solutions an idiom for asynchronous processing. You solution is cool for ``indeterminates datasets' where you cant tell in advance how much data you have to query. Generalise the step 2,3,4 into this. 2. the new LONG TERM thread LT is created and the ActionForm B associated with the HttpSession (per Login account) registers its self as a Observer of LT. 3. Whilst LT is processing, every so often, it fired an notification event of the progress to the registered listener. 4. The processing page is refreshing or a Web User submits the page for a new update. The Processing Action only has to call the accessor of the ActionForm B to find out how far the LTT has process. This is the solution for `determinate dataset'. I have implemented the `determinate dataset' solution for the `eForum' component that uses `Expresso Framework'. This framework has support for `Jobs' for long term processes. I wrote a `Job' to index the forum messages using the Jakarta Lucene and it has a `IndexingProgressionBean' or something like that ... You also might want to check out the `Quartz Scheduler'. hth -- Peter Pilgrim Operations/IT - Credit Suisse First Boston, 10 South Colonnade, London E14 4QJ, United Kingdom Tel: +44-(0)207-883-4497 ============================================================================== This message is for the sole use of the intended recipient. If you received this message in error please delete it and notify us. If this message was misdirected, CSFB does not waive any confidentiality or privilege. CSFB retains and monitors electronic communications sent through its network. Instructions transmitted over this system are not binding on CSFB until they are confirmed by us. Message transmission is not guaranteed to be secure. ============================================================================== --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]