[Simpleweb-Support] Non Executor-based Asynchronous Service
Brought to you by:
niallg
From: Luis A. <lan...@gm...> - 2014-06-11 12:01:01
|
Hi, I have read through the section on Asynchronous Services located at http://www.simpleframework.org/doc/tutorial/tutorial.php. I notice that the example uses a java.util.concurrent.Executor to spawn the asynchronous task. Is it possible to do the same without using a thread-based approach? That is, can we achieve the same result using a Selector and NIO? For example, I thought about using the SocketChannel associated with the Request to register with a Selector, but I cannot see any way to access that SocketChannel. I am trying to allow potentially many requests to remain suspended for long periods of time. If I start a new thread for every request, this becomes resource-intensive and expensive. Using NIO, I could have just a single separate thread that monitors the Selector. Any help you could provide would be much appreciated. By the way, thanks for contributing such great software! Luis |