File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Web service and threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web service and threads" Watch "Web service and threads" New topic

Web service and threads

Robert Werutsky

Joined: Aug 24, 2009
Posts: 1

I'm developing a project where I have this scenario:
1 - a client sends a message to the web service with a list of IP adresses
2 - the web service starts to probe those IP adresses from time to time (for example, every 3 minutes. And the probes are SNMP (simple network management protocol) )
3 - so, every 3 minutes, the web service sends a response to the client with the information gathered from the probes (this reponse should be another web service call, since the client is a web service too)

to solve this I would like to create a thread with the @webService annotation that receive the list of IP adresses and another thread that is always running to do the probes and then send the response ...
is it possible ???
I'm new to web service ....

thanks !!!
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
Are your webservice running in some kind of container, like Tomcat, GlassFish or such?
If so, then the container will create threads that handles incoming requests.
Keep in mind the difference between servlet-based and EJB-based endpoints; the first can be executed by any number of threads at the same time while the second is only executed by one single thread at a time.
Best wishes!
I agree. Here's the link:
subject: Web service and threads
It's not a secret anymore!