NGSession take ( ) { synchronized ( lock ) { if ( done ) { throw new UnsupportedOperationException ( "NGSession pool is shutting down" ) ; } NGSession session = idlePool . poll ( ) ; if ( session == null ) { session = instanceCreator . get ( ) ; session . start ( ) ; } workingPool . add ( session ) ; return session ; } }
Returns an NGSession from the pool or creates one if necessary