// to physically remove it from disk.
if(hfoFile.exists()) {
if(deleteQuietly(hfoFile)) {
repo.deleteObject(key);
} else {
throw new ObjectDeletionException("Failed " +
"to delete object from disk (file=" +
hfoFile.getAbsolutePath() +
", id=" + repo.getRepoId() + ")");
}
} else {
// So the object was in the index in memory, but
// was not found on disk. Hm, probably a bigger
// issue.
throw new ObjectNotFoundException("Object " +
"file on disk not found (file=" +
hfoFile.getAbsolutePath() + ", id=" +
repo.getRepoId() + ", key=" +
key + ")");
}
return hfo;
}
}.write(); // Exclusive lock, fail immediately if HFO busy
}
@Override
public void success(final HashedFileObject hfo) throws Exception {
// If we get here, then the deletion must have succeeded.
// Queue the repository to be flushed to disk.
metaWriter_.queue(repo);
}
}.read(false); // Shared reader lock on repo, no wait
} catch (LockConflictException e) {
throw e;
} catch (ObjectNotFoundException e) {
throw e;
} catch (ObjectDeletionException e) {
throw e;
} catch (Exception e) {
throw new ObjectDeletionException("Failed to delete file " +
"object (id=" + repo.getRepoId() + ", key=" + key + ")", e);
}
}