@Test
  public void testIsFileClosed() throws IOException {
    // Make this time long so it is plain we broke out because of the isFileClosed invocation.
    HTU.getConfiguration().setInt("hbase.lease.recovery.dfs.timeout", 100000);
    CancelableProgressable reporter = mock(CancelableProgressable.class);
    when(reporter.progress()).thenReturn(true);
    IsFileClosedDistributedFileSystem dfs = mock(IsFileClosedDistributedFileSystem.class);
    // Now make it so we fail the first two times -- the two fast invocations, then we fall into
    // the long loop during which we will call isFileClosed.... the next invocation should
    // therefore return true if we are to break the loop.
    when(dfs.recoverLease(FILE)).thenReturn(false).thenReturn(false).thenReturn(true);
    when(dfs.isFileClosed(FILE)).thenReturn(true);
    RecoverLeaseFSUtils.recoverFileLease(dfs, FILE, HTU.getConfiguration(), reporter);
    verify(dfs, times(2)).recoverLease(FILE);
    verify(dfs, times(1)).isFileClosed(FILE);
  }
Test that isFileClosed makes us recover lease faster.
hbase-asyncfs/src/test/java/org/apache/hadoop/hbase/util/TestRecoverLeaseFSUtils.java