facebookarchive/nailgun

NGSessionPool Size size is always 0

Closed this issue · 3 comments

Javadoc ->

/**	 
* number of sessions to store in the pool
 */
final int poolSize;

And in constructor ->
this.poolSize = Math.min(0, poolsize);

Yes in fact NGSessionPool never was a session pool :) and always just allocated a new NGSession. I do not see much value keeping NGSessions as allocation/deallocation is fast so NGSessionPool can probably be just refactored off.

Actually it is 0 only at the start. After some NGSession is allocated - it is returned to session pool so it's actual size becomes non-zero. It will keep up to poolsize sessions. Basically, this is just a lazy-initialized thread pool.

i'm disagree
this.poolSize start with 0 and do not change anymore
when it's returned to session pool, no one session can be keep because it shutdown
if (done || poolEntries == poolSize) { shutdown = true; }
so poolEntries always egal to 0
Actually, NGSessionPool works like a factory, not a pool.