user1008893
user1008893

Reputation:

Running a separate program alongside web application

I have a web application written in Java, deployed through Tomcat. I have a separate Java program that I would like to always have running while the webapp is 'live'. I would only like one instance of this program running at any given time.

What is the best way to go about achieving this effect? Please let me know if more details are required.

Upvotes: 0

Views: 76

Answers (1)

nobeh
nobeh

Reputation: 10049

Implement a ServletContextListener. Initialize your standalone application when the context is initialized and destroy it when the web application is destroyed. An example.

Upvotes: 2

Related Questions