boolean recoverLease ( String src , String holder , String clientMachine , boolean discardLastBlock ) throws IOException { // convert names to array of bytes w/o holding lock byte [ ] [ ] components = INodeDirectory . getPathComponents ( src ) ; writeLock ( ) ; try { if ( isInSafeMode ( ) ) { throw new SafeModeException ( "Cannot recover the lease of " + src , safeMode ) ; } INode inode = dir . getFileINode ( components ) ; if ( inode == null ) { throw new FileNotFoundException ( "File not found " + src ) ; } if ( ! inode . isUnderConstruction ( ) ) { return true ; } if ( isPermissionEnabled ) { INode [ ] inodes = dir . getExistingPathINodes ( src ) ; if ( isPermissionCheckingEnabled ( inodes ) ) { checkPathAccess ( src , inodes , FsAction . WRITE ) ; } } return recoverLeaseInternal ( inode , src , holder , clientMachine , true , discardLastBlock ) ; } finally { writeUnlock ( ) ; } }
Recover lease ; Immediately revoke the lease of the current lease holder and start lease recovery so that the file can be forced to be closed .