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?
posted 10 years ago
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.