Emmanuel Lcharny wrote:
>Well, I think it's much more to follow advice 68 from Joshua Bloch (Effective 
>Java, edition 2) : "Prefer executors and tasks to threads"


I just went out and read that section of the book.  That's a pretty good point, 
it makes management and cleanup of the threads a lot easier.  I suppose the 
main thing that put me off a bit was that it seems pretty dangerous to allow 
someone to pass in their own executor that could have a limited thread 
capacity, when it is pretty important for the threads to be available when 
creating the processors and acceptor thread.  I can see why it might be 
advantageous to allow someone to pass in their own ThreadFactory for the sake 
of naming or whatever, and the under the covers just wrapping that in a cached 
executor pool for management purposes.  The danger could payoff I suppose in 
the case someone has something particularly interesting they want to do given 
the flexibility of controlling which executors are used.

Chris


      

Reply via email to