use of org.apache.hadoop.hdfs.server.namenode.LeaseExpiredException in project lucene-solr by apache.
the class FSHDFSUtils method recoverLease.
/**
* Try to recover the lease.
* @return True if dfs#recoverLease came by true.
*/
static boolean recoverLease(final DistributedFileSystem dfs, final int nbAttempt, final Path p, final long startWaiting) throws FileNotFoundException {
boolean recovered = false;
try {
recovered = dfs.recoverLease(p);
log.info("recoverLease=" + recovered + ", " + getLogMessageDetail(nbAttempt, p, startWaiting));
} catch (IOException e) {
if (e instanceof LeaseExpiredException && e.getMessage().contains("File does not exist")) {
// This exception comes out instead of FNFE, fix it
throw new FileNotFoundException("The given transactionlog file wasn't found at " + p);
} else if (e instanceof FileNotFoundException) {
throw (FileNotFoundException) e;
}
log.warn(getLogMessageDetail(nbAttempt, p, startWaiting), e);
}
return recovered;
}
Aggregations