• 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

spawning a daemon thread on Tomcat startup

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm exploring the possibility of spawning a daemon thread, that would act as a heartbeat listener,at the Tomcat server startup.

The tomcat server ,on startup, spawns the following threads,among others.

- the main thread that listens on 8005 and awaits SHUTDOWN requests

- the JIOEndpoint Acceptor thread that listens on 8080 for incoming TCP/IP connections

- A processor thread that listens on 8009 for Apache webserver connections

- Other processor threads

I intend to spawn my heartbeat listener thread from the main thread.

Is there a way to achieve that by supplying my code and patching it up with the tomcat binaries? In other words, is it possible to write some sort of plugin?

Or do I need to build the tomcat code along with the hearbeat listener code?

-thanks a lot for your comments.

[ July 08, 2008: Message edited by: Ajay Saxena ]
[ July 08, 2008: Message edited by: Ajay Saxena ]
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That seems unnecessarily complicated. Why not just start the daemon Thread from - say - a ServletContextListener for an app that gets initialized on server startup?

Bill
 
Ajay Saxena
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, that would probably be a cleaner approach. In fact I came across such a suggestion on the web somewhere. But still wanted to explore other alternatives. Looks like it's time I revisited the servlet container features of Tomcat. I was actually viewing Tomcat from a management/monitoring perspective,so didn't quite consider this approach.

-thanks for your time and suggestion!
 
Rototillers convert rich soil into dirt. Please note that this tiny ad is not a rototiller:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic