Trustin Lee wrote:

    3)       While trying to understand (2) I noticed the following
    code in SimpleServiceRegistry:

219     private void startThreadPools()

220     {

221         if( !services.isEmpty() )

222             return;

223
224         ioThreadPoolFilter.start();

225         protocolThreadPoolFilter.start();

226     }

    Is this correct? You only start the thread pools when there are no
    services? Looks odd.

It is correct because startThreadPools() is invoked whenever bind() is called(). Thread pools should be started only when it is the first bind.


I also happened to browse this code yesterday, and I was also wondering whether this was correct.
I figured the examples wouldn't work if it wasn't.
But maybe some comment in the code might clarify it for anyone quickly reading through the code.
Just a very minor enhancement.

Maarten

Reply via email to