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);
 }
 public void shutdown() throws Exception {
   cleanUp();
   setup.tearDown();
   if (mr != null) {
     mr.shutdown();
     mr = null;
   }
   FileSystem.closeAll();
   if (dfs != null) {
     dfs.shutdown();
     dfs = null;
   }
 }
 @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();
  }
Exemple #5
0
 public void close() throws IOException {
   FileSystem.closeAll();
 }