File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Question about Tomcat capabilities, triggers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Question about Tomcat capabilities, triggers" Watch "Question about Tomcat capabilities, triggers" New topic

Question about Tomcat capabilities, triggers

Axel Richardson

Joined: Jun 28, 2012
Posts: 3

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,
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
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

Joined: Jun 25, 2001
Posts: 17417

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).

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Question about Tomcat capabilities, triggers
It's not a secret anymore!