Posted by jrsharp
on December 29, 2007 at 9:44 PM PST
I have created a JAX-WS endpoint using annotations as described in the fromjava example and I'm at a bit of a loss how to proceed to create a thread that can do the necessary polling so that the data will be available for web service requests.
I'm currently deploying my war file using an embedded instance of Jetty 6.1.6. Because Servlets (and WSServlets) should already have a running thread associated with them, I decided to extend WSServlet with the logic necessary to conduct the polling necessary. (The thread will poll some custom hardware on the machine and store status information)
At this point, however, I cant seem to figure out how I can get a reference to this custom servlet object from within my JAX-WS endpoint class. It seems that if I could do that, I'd have access to the data I need that is being polled and updated within the servlet's thread method. Is there a way to do this? Even if there is, is this the recommended way to accomplish this sort of thing?
Is it possible to make the endpoint class itself do more? Could it have a reference to a separate Thread? How would such a Thread be started?
I will be grateful for any help or input that can be provided.