permaculture playing cards*
The moose likes Servlets and the fly likes Running a Socket server process in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Running a Socket server process in Tomcat" Watch "Running a Socket server process in Tomcat" New topic
Author

Running a Socket server process in Tomcat

Chandru Ganesan
Ranch Hand

Joined: Feb 08, 2003
Posts: 37
Hi

I have a Socket server process and a SOAP service process using Apache-Axis. They are 2 different threads sharing a hashtable. The socket server updates the hashtable and the SOAP service reads from the hashtable. Both process should be run under Tomcat web container.

My questions is, how do I start the socket server background process under Tomcat? The socket server is a plain Java class (NOT a Servlet).

Thanks for yore ideas.

Chandru
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
You could start the thread with a javax.servlet.ServletContextListener (which gets called when the web application is deployed and when it's shut down).


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Chandru Ganesan
Ranch Hand

Joined: Feb 08, 2003
Posts: 37
Hi Lasse

Thanks for your input

Chandru
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Running a Socket server process in Tomcat