We use axis2 for building our webservices and a Jboss server to run the logic of all of our applications. We were asked to build a webservice that talks to a bean that could
I don't think stateful session beans are the answer to your problem, they're designed for long-running conversational sessions, which isn't your scenario.
My recommendation would be to use a Java5-style ExecutorService thread pool, created using the Executors factory class:
ExecutorService
instance.Callable.call()
method would make the actual invocation on the business logic bean, in whatever form that takes.Callable
is passed to ExecutorService.submit()
, which immediately returns a Future
object representing the eventual result of the call. The Executor
will start to invoke your Callable
in a separate thread.Future
in a Map
with the token as the key.Future
using the token, and calls get()
on the Future
, with a timeout value so that it only waits a short time for the answer. The get()
call will return the execution result of whatever the Callable
invoked.
Future
from the `Map.It's a pretty robust approach. You can even configure the ExecutorService
to limit the number of calls that can be in execution at the same time, if you so desire.
Another approach you could take is to make use of JMS and a DB.
The process would be
This process is a bit heavier on resource usage, but has some advantages