File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes HttpSessionBindingListener to speed up the execution Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "HttpSessionBindingListener to speed up the execution" Watch "HttpSessionBindingListener to speed up the execution" New topic

HttpSessionBindingListener to speed up the execution

ramnna jain
Ranch Hand

Joined: Mar 16, 2009
Posts: 129

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?

I am using tomcat 5.5 and struts 1.3.
David Newton

Joined: Sep 29, 2008
Posts: 12617

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).
ramnna jain
Ranch Hand

Joined: Mar 16, 2009
Posts: 129

Actually I mean the end user get quick response(action quickly returns back) & things happening in the background... may be I am still wrong.. please correct me.

As far as resources, infrastructure and efficient ways to do things... I really like the idea of using thread for resizing images
and using Message Ques to send mails. I must really think this way...

Thanks for your guidance.

I agree. Here's the link:
subject: HttpSessionBindingListener to speed up the execution
jQuery in Action, 3rd edition