当前位置: 首页>>代码示例>>Java>>正文


Java MRAsyncDiskService.TOBEDELETED属性代码示例

本文整理汇总了Java中org.apache.hadoop.mapreduce.util.MRAsyncDiskService.TOBEDELETED属性的典型用法代码示例。如果您正苦于以下问题:Java MRAsyncDiskService.TOBEDELETED属性的具体用法?Java MRAsyncDiskService.TOBEDELETED怎么用?Java MRAsyncDiskService.TOBEDELETED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.mapreduce.util.MRAsyncDiskService的用法示例。


在下文中一共展示了MRAsyncDiskService.TOBEDELETED属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testVolumeNormalization

@Test
/** Test that volumes specified as relative paths are handled properly
 * by MRAsyncDiskService (MAPREDUCE-1887).
 */
public void testVolumeNormalization() throws Throwable {
  LOG.info("TEST_ROOT_DIR is " + TEST_ROOT_DIR);

  String relativeTestRoot = relativeToWorking(TEST_ROOT_DIR);

  FileSystem localFileSystem = FileSystem.getLocal(new Configuration());
  String [] vols = new String[] { relativeTestRoot + "/0",
      relativeTestRoot + "/1" };

  // Put a file in one of the volumes to be cleared on startup.
  Path delDir = new Path(vols[0], MRAsyncDiskService.TOBEDELETED);
  localFileSystem.mkdirs(delDir);
  localFileSystem.create(new Path(delDir, "foo")).close();

  MRAsyncDiskService service = new MRAsyncDiskService(
      localFileSystem, vols);
  makeSureCleanedUp(vols, service);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestMRAsyncDiskService.java

示例2: testMRAsyncDiskServiceStartupCleaning

/**
 * This test creates some directories inside the toBeDeleted directory and
 * then start the asyncDiskService.
 * AsyncDiskService will create tasks to delete the content inside the
 * toBeDeleted directories.
 */
@Test
public void testMRAsyncDiskServiceStartupCleaning() throws Throwable {
  FileSystem localFileSystem = FileSystem.getLocal(new Configuration());
  String[] vols = new String[]{TEST_ROOT_DIR + "/0",
      TEST_ROOT_DIR + "/1"};

  String a = "a";
  String b = "b";
  String c = "b/c";
  String d = "d";
  
  // Create directories inside SUBDIR
  String suffix = Path.SEPARATOR_CHAR + MRAsyncDiskService.TOBEDELETED;
  File fa = new File(vols[0] + suffix, a);
  File fb = new File(vols[1] + suffix, b);
  File fc = new File(vols[1] + suffix, c);
  File fd = new File(vols[1] + suffix, d);
  
  // Create the directories
  fa.mkdirs();
  fb.mkdirs();
  fc.mkdirs();
  fd.mkdirs();

  assertTrue(fa.exists());
  assertTrue(fb.exists());
  assertTrue(fc.exists());
  assertTrue(fd.exists());
  
  // Create the asyncDiskService which will delete all contents inside SUBDIR
  MRAsyncDiskService service = new MRAsyncDiskService(
      localFileSystem, vols);
  
  // Make sure everything is cleaned up
  makeSureCleanedUp(vols, service);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:42,代码来源:TestMRAsyncDiskService.java

示例3: makeSureCleanedUp

private void makeSureCleanedUp(String[] vols, MRAsyncDiskService service)
    throws Throwable {
  // Sleep at most 5 seconds to make sure the deleted items are all gone.
  service.shutdown();
  if (!service.awaitTermination(5000)) {
    fail("MRAsyncDiskService is still not shutdown in 5 seconds!");
  }
  
  // All contents should be gone by now.
  for (int i = 0; i < vols.length; i++) {
    File subDir = new File(vols[0]);
    String[] subDirContent = subDir.list();
    assertEquals("Volume should contain a single child: "
        + MRAsyncDiskService.TOBEDELETED, 1, subDirContent.length);
    
    File toBeDeletedDir = new File(vols[0], MRAsyncDiskService.TOBEDELETED);
    String[] content = toBeDeletedDir.list();
    assertNotNull("Cannot find " + toBeDeletedDir, content);
    assertEquals("" + toBeDeletedDir + " should be empty now.", 0,
        content.length);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestMRAsyncDiskService.java


注:本文中的org.apache.hadoop.mapreduce.util.MRAsyncDiskService.TOBEDELETED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。