question: public boolean lockWithRetries ( ) { try { for ( int i = 0 ; i < retryCount ; i ++ ) { if ( lock ( ) ) { return true ; } else { Thread . sleep ( retryTimeout * 1000L ) ; } } } catch ( InterruptedException e ) { return false ; } return false ; }
target:  API for enabling the locking of file with retries.