public static DistributedFileSystem getDFS(Configuration conf, FileSystem dfs)
     throws IOException {
   Configuration clientConf = new Configuration(conf);
   clientConf.set("fs.hdfs.impl", "org.apache.hadoop.hdfs.DistributedFileSystem");
   clientConf.setBoolean("fs.hdfs.impl.disable.cache", true);
   URI dfsUri = dfs.getUri();
   FileSystem.closeAll();
   return (DistributedFileSystem) FileSystem.get(dfsUri, clientConf);
 }
示例#2
0
 public void shutdown() throws Exception {
   cleanUp();
   setup.tearDown();
   if (mr != null) {
     mr.shutdown();
     mr = null;
   }
   FileSystem.closeAll();
   if (dfs != null) {
     dfs.shutdown();
     dfs = null;
   }
 }
示例#3
0
 @After
 public void stopCluster() throws Exception {
   try {
     if (this.executor != null) {
       this.executor.stop();
       this.executor = null;
       FileSystem.closeAll();
       System.gc();
     }
   } finally {
     deleteAllTempFiles();
   }
 }
  @AfterClass
  public static void teardownClass() throws Exception {
    System.clearProperty("solr.hdfs.blockcache.enabled");
    System.clearProperty("test.build.dir");
    System.clearProperty("test.build.data");
    System.clearProperty("test.cache.data");

    if (mrCluster != null) {
      mrCluster.shutdown();
      mrCluster = null;
    }
    if (dfsCluster != null) {
      dfsCluster.shutdown();
      dfsCluster = null;
    }

    FileSystem.closeAll();
  }
示例#5
0
 public void close() throws IOException {
   FileSystem.closeAll();
 }