public OClosableEntry < K , V > acquire ( K key ) throws InterruptedException { checkOpenFilesLimit ( ) ; final OClosableEntry < K , V > entry = data . get ( key ) ; if ( entry == null ) return null ; boolean logOpen = false ; entry . acquireStateLock ( ) ; try { if ( entry . isRetired ( ) || entry . isDead ( ) ) { return null ; } else if ( entry . isClosed ( ) ) { entry . makeAcquiredFromClosed ( entry . get ( ) ) ; logOpen = true ; } else if ( entry . isOpen ( ) ) { entry . makeAcquiredFromOpen ( ) ; } else { entry . incrementAcquired ( ) ; } } finally { entry . releaseStateLock ( ) ; } if ( logOpen ) { logOpen ( entry ) ; } else { logAcquire ( entry ) ; } assert entry . get ( ) . isOpen ( ) ; return entry ; }
Acquires item associated with passed in key in container . It is guarantied that item will not be closed if limit of open items will be exceeded and container will close rarely used items .