@ Override public T get ( final long timeout , final TimeUnit timeUnit ) { if ( closed ) { throw new IllegalStateException ( "The pool is closed" ) ; } if ( ! acquirePermit ( timeout , timeUnit ) ) { throw new MongoTimeoutException ( String . format ( "Timeout waiting for a pooled item after %d %s" , timeout , timeUnit ) ) ; } T t = available . pollLast ( ) ; if ( t == null ) { t = createNewAndReleasePermitIfFailure ( false ) ; } return t ; }
Gets an object from the pool - will block if none are available