• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Returning from action when user leaves page

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have an issue and as of now I have no idea about how to solve it..

Basically I have in my application a function that takes a long time to execute. When the user starts that function a certain commmand is submitted to a queue for asynchronous processing. On the UI side the user is displayed a page saying that the function is being processed and that it may take a long time. Behind that page there is an action checking periodically on the status of the processing. If the processing is done the next page is displayed, otherwise the user stays on the same page.

The user may decide not to wait and just go to a different page. Everything works fine but the problem is that the action checking on the status of the transaction keeps being executed, until the transaction finishes, after that since anyway the user is gone to a different page he won't be forwarded to the next page for that action, and this is fine.

I just want to figure out how I can intercept in the action checking on the status of the processing that the user has left the page and is not waiting for the end of the transaction anymore.

Any ideas?

Thanks a lot!

Paola
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

At the moment, I can think of a couple of different strategies to deal with it. There're probably others, which I also would like to hear.

- Option 1:
Instead of making the "processing" action check if the user still is viewing the original page, you could have the original page sending temporary requests (every 10 seconds, for example) to the server saying it's still there. If the server doesn't receive this requests in a while, the action knows that the user has left the original page.

- Option 2 (don't really think it's a good idea; it doesn't scale well and doesn't separate concerns well):
If the user has a limited number of pages he can go to after starting the process, and this number is small (and not likely to grow), you could make the actions associated with these pages "send a message" to the "processing" action warning that the user has left the original page.
 
Of course, I found a very beautiful couch. Definitely. And this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic