Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Asynchronous processing in servlets

 
Siva Krishnamurthy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are having a problem where in we need to do some processing asynchrnously in a servlet as it takes time to do that part.
Is it a good practice to spawn a thread inside a serrvlet?? Or can JMS be used? I'm new to the messaging technology..
Please help...
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think either one of them will be a good approach. There are a few concerns. For instance, if you're running this in a pure web container like Tomcat, you may not have a built in JMS service available, so you'd have to run one separately. In JBoss, I think it's taken care of, but that's different software.
But I don't see any reason why either approach wouldn't be okay. Using a separate thread seems a lot more simple and to the point. JMS would be more extensible in the future, but maybe you don't really need all that to do what you want. Options, options, options.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this month's Javaranch Journal, where I write an article on EXACTLY THIS!
Kyle
 
Siva Krishnamurthy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic