I'm working on consolidating our thread pools.
We'll have one ThreadPoolExecutor and one ScheduledThreadPoolExecutor on the server. Everything will use that. (We can't schedule off a standard thread pool executor).
The pools max size can be configured. If set to -1 it will use a newCachedThreadPool() and will effectively have no upper limit. if +ve then it will use a fixedThreadPool().
Also we have a single thread for the expiry reaper. This can't use the pool since it's priority needs to be individually configured.
Also AIO currently has one thread per file. This needs to be changed. (I've left that for Clebert).
I've completed and committed the server side (apart from the AIO change).
On the client side things are more tricky since there's no single "server" object to hold the pools.
What I'm going to do is allow a session factory to use its own thread pool if it wants (configure max threads). If it doesn't specify that it will use a static pool shared by all session factories in the classloader.