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 Apache's XML-RPC and Threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Apache Watch "Apache New topic

Apache's XML-RPC and Threads

Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
I'm creating an XML-RPC server using Apache's implementation and creating several handlers that search COBOL files and return results. Long story short, the handler may not return for quite some time. Since Apache's XML-RPC implementation appears to not spawn a new thread for each incoming request, I believe this will result in delays or deadlock when it waits for the handler to return. How can I prevent this from happening? I don't want the server to be stuck waiting on a handler that's performing a time consuming task, yet the handler can't return with a result until that task is finished. What do I do?
Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
I found the answer myself looking through the source code and running it in a debugger for observation. They use a worker pool and reuse them as new requests come in to handle them asynchronously. If none are available and if they're below their limit on Threads they create a new one, otherwise an exception gets thrown.

Now I just have to figure out how to implement my own pool of Threads to use for the I/O, but that's beyond the scope of this forum so I won't even bother asking.
Consider Paul's rocket mass heater.
subject: Apache's XML-RPC and Threads
Similar Threads
How do you execute new code in an existing Thread?
Soap without web services
how to implement XML-RPC
Connectivity to External System
Binding Endpoint to HTTPS problem