• 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

Starting a java process via servlet

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have written a simple server which listens to a queue and when it gets a message processes it. Now I want this server to run all the time and have the following options - I am using Tomcat.

1. Write a script which runs the main method and periodically checks if the process is running , if not then start the process.

2. (I am leaning towards this one) Write a servlet that initializes on start up and starts the server. This would be nice since I can let the container manage the starting/stopping etc, also there is a web console for people to monitor the server and I can add more things for monitoring. Is there any reason this is not a good idea ? What are the limitations of running my process within the container ?
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think running the application as a service is a better idea. For Windows you need to search for "Java Service Wrapper", a solution that can wrap your Java programs into a Windows service.
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rob Prime:
I think running the application as a service is a better idea. For Windows you need to search for "Java Service Wrapper", a solution that can wrap your Java programs into a Windows service.



The "Java Service Wrapper" is not just for windows - it is for almost all platforms
[ September 30, 2008: Message edited by: Rene Larsen ]
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even better!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic