Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about Tomcat capabilities, triggers

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

I was recently introduced to Tomcat, so I don't have a lot of experience in that department.
As I have understood Tomcat is stateless.

But I am still wondering if there is a possibility to add triggers of some sort?
Like its able to execute a method in every 24 hours or something similar?(e.g. threads and timers?)

Any help is appreciated.

Best Regards,
Axel.R
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No need to involve Tomcat, check out the java.util.Timer and TimerTask classes. You can set those up in a context listener of your web app.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18165
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Axel!

I suppose that you could describe Tomcat as "stateless". I never considered it in that light.

Tomcat isn't really the ideal container for non-web tasks. It does have the advantage of being a central nexus for different types of work, but that's about its only virtue for non-web functionality. You would be better off considering a simple non-web container such as a workflow engine, Enterprise Service Bus or OSGi container (these things tend to overlap). A place where I used to work used an Inversion of Control-based container descended from Apache's Avalon project. There were a whole raft of these things, although most of them have faded away now, and I never discovered what was supposed to fill the vacancy.

For scheduling, there's Quartz or the OS "cron" facility (Windows has a similar scheduler).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic