public T get ( ) { try { boolean acquired = semaphore . tryAcquire ( timeout , timeUnit ) ; if ( ! acquired ) throw EjbLogger . ROOT_LOGGER . failedToAcquirePermit ( timeout , timeUnit ) ; } catch ( InterruptedException e ) { throw EjbLogger . ROOT_LOGGER . acquireSemaphoreInterrupted ( ) ; } T bean = pool . poll ( ) ; if ( bean != null ) { //we found a bean instance in the pool, return it return bean ; } try { // Pool is empty, create an instance bean = create ( ) ; } finally { if ( bean == null ) { semaphore . release ( ) ; } } return bean ; }
Get an instance without identity . Can be used by finders create - methods and activation