in hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/FileSystemShimImpl.java [90:128]
public FileSystemShimImpl(
final FileSystem instance,
final boolean raiseExceptionsOnOpenFileFailures) {
super(FileSystem.class, instance);
// this is always present and used as the fallback
classicOpenFile = new OpenFileThroughClassicAPI(getInstance());
// use the builder if present, and configured.
OpenFileThroughBuilderAPI builderAPI = null;
Configuration conf = instance.getConf();
if (conf.getBoolean(FS_OPTION_SHIM_OPENFILE_ENABLED,
FS_OPTION_SHIM_OPENFILE_ENABLED_DEFAULT)) {
builderAPI = new OpenFileThroughBuilderAPI(getInstance());
if (builderAPI.openFileFound()) {
//the method is present, so bind to it.
openFileThroughBuilder = builderAPI;
useOpenFileAPI.set(true);
} else {
LOG.debug("Builder API enabled but not found");
openFileThroughBuilder = null;
}
} else {
// builder not enabled
LOG.debug("Builder API not enabled");
openFileThroughBuilder = null;
}
// the simpler methods.
Class<FileSystem> clazz = getClazz();
hasPathCapabilityMethod = loadInvocation(clazz, "hasPathCapability",
Boolean.class,
Path.class, String.class);
msyncMethod = loadInvocation(clazz, "msync", Void.class);
executeOpenFile = new OpenFileThroughAvailableOperation();
}