Example usage for org.apache.hadoop.fs CommonConfigurationKeysPublic FS_AUTOMATIC_CLOSE_KEY

List of usage examples for org.apache.hadoop.fs CommonConfigurationKeysPublic FS_AUTOMATIC_CLOSE_KEY

Introduction

In this page you can find the example usage for org.apache.hadoop.fs CommonConfigurationKeysPublic FS_AUTOMATIC_CLOSE_KEY.

Prototype

String FS_AUTOMATIC_CLOSE_KEY

To view the source code for org.apache.hadoop.fs CommonConfigurationKeysPublic FS_AUTOMATIC_CLOSE_KEY.

Click Source Link

Usage

From source file:org.springframework.cloud.stream.app.hdfs.dataset.sink.HdfsDatasetSinkConfiguration.java

License:Apache License

@Bean
public DatasetRepositoryFactory datasetRepositoryFactory(org.apache.hadoop.conf.Configuration configuration) {
    DatasetRepositoryFactory datasetRepositoryFactory = new DatasetRepositoryFactory();
    org.apache.hadoop.conf.Configuration moduleConfiguration = new org.apache.hadoop.conf.Configuration(
            configuration);/*  w ww  . ja va 2s  .  co m*/
    // turn off auto closing of the Hadoop FileSystem since the shut-down hook might run before the sink one
    moduleConfiguration.setBoolean(CommonConfigurationKeysPublic.FS_AUTOMATIC_CLOSE_KEY, false);
    if (StringUtils.hasText(properties.getFsUri())) {
        moduleConfiguration.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, properties.getFsUri());
    }
    datasetRepositoryFactory.setConf(moduleConfiguration);
    datasetRepositoryFactory.setBasePath(properties.getDirectory());
    datasetRepositoryFactory.setNamespace(properties.getNamespace());
    return datasetRepositoryFactory;
}