• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

spawning a daemon thread on Tomcat startup

 
Ajay Saxena
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • 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 ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • 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
  • 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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic