Hi,
I was tired and obviously not thinking straigt as the error I was doing was calling
thread.run but not thread.start...
And that was the reason for application lockup..
It works fine right now.
Thanx
-reynir
-Original Message-
From: Nathan Smith [mailto:[EMAIL PROTECTED]]
Sent: 28. nóvember 2002 22:30
To: Tomcat Users List
Subject: Re: thread comunicating with ServletContexts
I have implemented Scheduler program that has a thread
monitoring a database table for any new tasks that need to be
run in the background. At the moment these tasks consist of
just servlets, but should probably work with a class that
extend a Struts Action.
I created an HttpURLConnection from a URL object, which
contains the URI part that normally invokes a servlet. i.e.
/servlet/some.servlet.Servlet with the context name on the
front of course, and the server name, port, and scheme (HTTP)
from the ServletContext object.
Once you are connected you can then fiddle around with
connection settings. Create an OutputStream to write to the
servlet and as InputStream to read from the servlet. I found
that I had to write to the servlet and then close the writer
and then open the input stream and close it in that order.
Hope this helps,
Nathan.
- Original Message -
From: Reynir Hübner [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 29, 2002 10:19 AM
Subject: thread comunicating with ServletContexts
Hi,
I have a slight problem
I am starting up a thread when application starts with a
ServletContextListener implementation. The purpouse of the
thread is to monitor a directory that has few xml descriptor
files in it. Attributes from the XML files are parsed into
the ServletContext on startup of the ServletContext, and then
it's possible to trigger reload by executing a servlet, that
does the reload.
Right now the initial load and the reload by servlet are
working, The thread is monitoring the directory every 10
seconds it checks if anything has been modified (works fine).
The problem I am facing right now is to find a way to pass
the attributes read by the Thread (instanciated in a
listener) from the xml files, into the ServletContext.
One way of doing it might be to run a HTTPUrlConnect against
the servlet that can then reload the attributes from the xml
files, that might work, but then I will have to worrie about
some authentication, etc. That I dont want to have to think
about right now.
I tried passing a ServletContext variable to the
ServletContext to the Thread, but that seems to lock up the
webapplication, meaning the thread runs fine but nothing else.
I'm tired and I think I must be not thinking straight, can
someone help me ?
:)
Thanx
-reynir
--
To unsubscribe, e-mail:
mailto:tomcat-user- [EMAIL PROTECTED]
For
additional commands,
e-mail: mailto:[EMAIL PROTECTED]
--
To unsubscribe, e-mail: mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]