• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help for creating Asynchronus Job in J2EE Environment - Tomcat

 
Greenhorn
Posts: 28
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a requirement where in i need perform some asynchronous jobs in J2EE app (with Tomcat Server), basically need to send mail notifications and do cleanup job.
I know using threads directly is not advisable, what are the options i have in Tomcat. Websphere has commonj workmanager implementations, but i need some open source Async task executors for Tomcat.
I came accross Foo Commonj libraries, but don't know how to use it. Moreover it doesn't supplies the commonj.work.work class or related files.
Can anyone let me know about any open source implementation of Workmanager with proper example, Haven't seen a single thread providing the proper explanation to this topic.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have actually never run into problems where using background threads created problems that weren't of my own making. I've definitely never noticed them interfering with Tomcat's operation, so I have no qualms using them. Check out the classes java.util.Timer and TimerTask, those provide a nice framework for setting and managing timed jobs. You can set them up and tear them down in a ServletContextListener.

But just to make sure: those jobs really need to run inside of Tomcat? Otherwise, a solution that uses a cron job to schedule invocation of a Java class would still be preferable.
 
reply
    Bookmark Topic Watch Topic
  • New Topic