class FileBackedRegistry extends AbstractRegistry<T> {

    @Override
    public CompletableFuture<ReloadResult> reload() {
        return supplyAsync(() -> {
            byte[] content = readFile();
            HashCode hashCode = md5().hashBytes(content);
            String modifyTime = fileModificationTime().map(FileTime::toString).orElse("NA");

            String logPrefix = format("timestamp=%s, md5-hash=%s", modifyTime, hashCode);

            if (hashCode.equals(fileHash)) {
                LOG.info("Not reloading {} as content did not change", configurationFile.absolutePath());
                return unchanged(format("%s, Identical file content.", logPrefix));
            } else {
                try {
                    boolean changesPerformed = updateResources(content, hashCode);

                    if (!changesPerformed) {
                        LOG.info("Not firing change event for {} as content was not semantically different", configurationFile.absolutePath());
                        return unchanged(format("%s, No semantic changes.", logPrefix));
                    } else {
                        LOG.debug("Changes applied!");
                        return reloaded(format("%s, File reloaded.", logPrefix));
                    }
                } catch (Exception e) {
                    // Eliminate unhelpful error message when resource constraint exception fails.
                    // This is a candidate for further refactoring.
                    if (!"Resource constraint failure".equals(e.getMessage())) {
                        LOG.error("Not reloading {} as there was an error reading content", configurationFile.absolutePath(), e);
                    }
                    return failed(format("%s, Reload failure.", logPrefix), e);
                }
            }
        }, newSingleThreadExecutor());
    }

    private  FileBackedRegistry(Resource configurationFile, Reader<T> reader, Supplier<FileTime> modifyTimeSupplier, Predicate<Collection<T>> resourceConstraint);
    @VisibleForTesting  FileBackedRegistry(Resource configurationFile, Reader<T> reader, Supplier<FileTime> modifyTimeSupplier);
    public  FileBackedRegistry(Resource configurationFile, Reader<T> reader, Predicate<Collection<T>> resourceConstraint);

}