Hmmmm....

Ian, what I have done and works...

1. Create a ContextListener for your application (example, I use Tomcat
4.1.x).
2. In the "public void contextInitialized(ServletContextEvent e) {"
method, initialize your Thread.
3. Still in this method, start your Thread (optional).
4. Now add the Thread as a context attribute.
5. Your application, can then if needed, access the thread by grabbing
the context attribute. If not, the thread at least has an active
reference and will run as long as the application is deployed.

HTH or inspires,

Thunder

-----Original Message-----
From: Brown, Mike [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 11, 2005 2:34 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Threads under axis

This isn't an axis problem. The servlet spec does not support threads
being
spawned by code running in the container. It also does not support
opening
ports or several other no-nos. 

-----Original Message-----
From: Ian Wootten [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 11, 2005 8:28 AM
To: [EMAIL PROTECTED]
Subject: Threads under axis

Hi there,

I was wondering if somebody could help me out with a simple thread
problem
I'm facing when my class is deployed. My class (a simple log4j
app) logs the environment variables to one file and issues a memory
monitoring thread in the background. I'm finding that the memory thread
doesn't seem to be running at all when deployed, but works fine when run
as
a standalone program. Even if I run a Thread.sleep(10000) command in the
main body of my code, it returns the string returned by my main service
method immediately...

Am I missing something, are the threads run differently under axis?

Thanks,

Ian

Reply via email to