private boolean tryLockCacheFile ( ) { int cnt = 0 ; boolean locked = false ; while ( cnt < 100 && ! ( locked = lockCacheFile ( ) ) ) { try { Thread . sleep ( 100 ) ; } catch ( InterruptedException ex ) { // doesn't matter } ++ cnt ; } if ( ! locked ) { LOGGER . debug ( "Failed to lock the cache file." ) ; } return locked ; }
Tries to lock the cache file