In my web application there is an action which takes time to complete because it does several things like
resizes an image in two different sizes and saves record also sends mail.
To reduce time I am trying to do it in a different way!
I am creating a class which is implementing HttpSessionBindingListener so that when the action gets executed
the action will create an object from it. The object will have required instance variables. When I add the object to
the users session, the valueBaund() will be called. The method is programmed to does other tasks.
I want to know if this approach is correct to implement?
How would that speed up execution? (This question is mostly so I know what your thought process is about why you went this route.)
How best to implement it also depends on your actual requirements (and infrastructure)--there are a number of ways to go about it, from starting up threads to full-blown message queues to avoid managing the threads ourselves (which technically we're not supposed to do, or at least that used to be the case).