Java 类org.apache.hadoop.util.AsyncDiskService 实例源码

项目:hadoop-oss    文件:TestAsyncDiskService.java   
/**
 * This test creates some ExampleTasks and runs them. 
 */
@Test
public void testAsyncDiskService() throws Throwable {

  String[] vols = new String[]{"/0", "/1"};
  AsyncDiskService service = new AsyncDiskService(vols);

  int total = 100;

  for (int i = 0; i < total; i++) {
    service.execute(vols[i%2], new ExampleTask());
  }

  Exception e = null;
  try {
    service.execute("no_such_volume", new ExampleTask());
  } catch (RuntimeException ex) {
    e = ex;
  }
  assertNotNull("Executing a task on a non-existing volume should throw an "
      + "Exception.", e);

  service.shutdown();
  if (!service.awaitTermination(5000)) {
    fail("AsyncDiskService didn't shutdown in 5 seconds.");
  }

  assertEquals(total, count);
}
项目:hadoop    文件:TestAsyncDiskService.java   
/**
 * This test creates some ExampleTasks and runs them. 
 */
@Test
public void testAsyncDiskService() throws Throwable {

  String[] vols = new String[]{"/0", "/1"};
  AsyncDiskService service = new AsyncDiskService(vols);

  int total = 100;

  for (int i = 0; i < total; i++) {
    service.execute(vols[i%2], new ExampleTask());
  }

  Exception e = null;
  try {
    service.execute("no_such_volume", new ExampleTask());
  } catch (RuntimeException ex) {
    e = ex;
  }
  assertNotNull("Executing a task on a non-existing volume should throw an "
      + "Exception.", e);

  service.shutdown();
  if (!service.awaitTermination(5000)) {
    fail("AsyncDiskService didn't shutdown in 5 seconds.");
  }

  assertEquals(total, count);
}
项目:aliyun-oss-hadoop-fs    文件:TestAsyncDiskService.java   
/**
 * This test creates some ExampleTasks and runs them. 
 */
@Test
public void testAsyncDiskService() throws Throwable {

  String[] vols = new String[]{"/0", "/1"};
  AsyncDiskService service = new AsyncDiskService(vols);

  int total = 100;

  for (int i = 0; i < total; i++) {
    service.execute(vols[i%2], new ExampleTask());
  }

  Exception e = null;
  try {
    service.execute("no_such_volume", new ExampleTask());
  } catch (RuntimeException ex) {
    e = ex;
  }
  assertNotNull("Executing a task on a non-existing volume should throw an "
      + "Exception.", e);

  service.shutdown();
  if (!service.awaitTermination(5000)) {
    fail("AsyncDiskService didn't shutdown in 5 seconds.");
  }

  assertEquals(total, count);
}
项目:big-c    文件:TestAsyncDiskService.java   
/**
 * This test creates some ExampleTasks and runs them. 
 */
@Test
public void testAsyncDiskService() throws Throwable {

  String[] vols = new String[]{"/0", "/1"};
  AsyncDiskService service = new AsyncDiskService(vols);

  int total = 100;

  for (int i = 0; i < total; i++) {
    service.execute(vols[i%2], new ExampleTask());
  }

  Exception e = null;
  try {
    service.execute("no_such_volume", new ExampleTask());
  } catch (RuntimeException ex) {
    e = ex;
  }
  assertNotNull("Executing a task on a non-existing volume should throw an "
      + "Exception.", e);

  service.shutdown();
  if (!service.awaitTermination(5000)) {
    fail("AsyncDiskService didn't shutdown in 5 seconds.");
  }

  assertEquals(total, count);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestAsyncDiskService.java   
/**
 * This test creates some ExampleTasks and runs them. 
 */
@Test
public void testAsyncDiskService() throws Throwable {

  String[] vols = new String[]{"/0", "/1"};
  AsyncDiskService service = new AsyncDiskService(vols);

  int total = 100;

  for (int i = 0; i < total; i++) {
    service.execute(vols[i%2], new ExampleTask());
  }

  Exception e = null;
  try {
    service.execute("no_such_volume", new ExampleTask());
  } catch (RuntimeException ex) {
    e = ex;
  }
  assertNotNull("Executing a task on a non-existing volume should throw an "
      + "Exception.", e);

  service.shutdown();
  if (!service.awaitTermination(5000)) {
    fail("AsyncDiskService didn't shutdown in 5 seconds.");
  }

  assertEquals(total, count);
}
项目:hadoop-EAR    文件:TestAsyncDiskService.java   
/**
 * This test creates some ExampleTasks and runs them. 
 */
public void testAsyncDiskService() throws Throwable {

  String[] vols = new String[]{"/0", "/1"};
  AsyncDiskService service = new AsyncDiskService(vols);

  int total = 100;

  for (int i = 0; i < total; i++) {
    service.execute(vols[i%2], new ExampleTask());
  }

  Exception e = null;
  try {
    service.execute("no_such_volume", new ExampleTask());
  } catch (RuntimeException ex) {
    e = ex;
  }
  assertNotNull("Executing a task on a non-existing volume should throw an "
      + "Exception.", e);

  service.shutdown();
  if (!service.awaitTermination(5000)) {
    fail("AsyncDiskService didn't shutdown in 5 seconds.");
  }

  assertEquals(total, count);
}
项目:hadoop-plus    文件:TestAsyncDiskService.java   
/**
 * This test creates some ExampleTasks and runs them. 
 */
@Test
public void testAsyncDiskService() throws Throwable {

  String[] vols = new String[]{"/0", "/1"};
  AsyncDiskService service = new AsyncDiskService(vols);

  int total = 100;

  for (int i = 0; i < total; i++) {
    service.execute(vols[i%2], new ExampleTask());
  }

  Exception e = null;
  try {
    service.execute("no_such_volume", new ExampleTask());
  } catch (RuntimeException ex) {
    e = ex;
  }
  assertNotNull("Executing a task on a non-existing volume should throw an "
      + "Exception.", e);

  service.shutdown();
  if (!service.awaitTermination(5000)) {
    fail("AsyncDiskService didn't shutdown in 5 seconds.");
  }

  assertEquals(total, count);
}
项目:hops    文件:TestAsyncDiskService.java   
/**
 * This test creates some ExampleTasks and runs them. 
 */
@Test
public void testAsyncDiskService() throws Throwable {

  String[] vols = new String[]{"/0", "/1"};
  AsyncDiskService service = new AsyncDiskService(vols);

  int total = 100;

  for (int i = 0; i < total; i++) {
    service.execute(vols[i%2], new ExampleTask());
  }

  Exception e = null;
  try {
    service.execute("no_such_volume", new ExampleTask());
  } catch (RuntimeException ex) {
    e = ex;
  }
  assertNotNull("Executing a task on a non-existing volume should throw an "
      + "Exception.", e);

  service.shutdown();
  if (!service.awaitTermination(5000)) {
    fail("AsyncDiskService didn't shutdown in 5 seconds.");
  }

  assertEquals(total, count);
}
项目:hadoop-TCP    文件:TestAsyncDiskService.java   
/**
 * This test creates some ExampleTasks and runs them. 
 */
@Test
public void testAsyncDiskService() throws Throwable {

  String[] vols = new String[]{"/0", "/1"};
  AsyncDiskService service = new AsyncDiskService(vols);

  int total = 100;

  for (int i = 0; i < total; i++) {
    service.execute(vols[i%2], new ExampleTask());
  }

  Exception e = null;
  try {
    service.execute("no_such_volume", new ExampleTask());
  } catch (RuntimeException ex) {
    e = ex;
  }
  assertNotNull("Executing a task on a non-existing volume should throw an "
      + "Exception.", e);

  service.shutdown();
  if (!service.awaitTermination(5000)) {
    fail("AsyncDiskService didn't shutdown in 5 seconds.");
  }

  assertEquals(total, count);
}
项目:hardfs    文件:TestAsyncDiskService.java   
/**
 * This test creates some ExampleTasks and runs them. 
 */
@Test
public void testAsyncDiskService() throws Throwable {

  String[] vols = new String[]{"/0", "/1"};
  AsyncDiskService service = new AsyncDiskService(vols);

  int total = 100;

  for (int i = 0; i < total; i++) {
    service.execute(vols[i%2], new ExampleTask());
  }

  Exception e = null;
  try {
    service.execute("no_such_volume", new ExampleTask());
  } catch (RuntimeException ex) {
    e = ex;
  }
  assertNotNull("Executing a task on a non-existing volume should throw an "
      + "Exception.", e);

  service.shutdown();
  if (!service.awaitTermination(5000)) {
    fail("AsyncDiskService didn't shutdown in 5 seconds.");
  }

  assertEquals(total, count);
}
项目:hadoop-on-lustre2    文件:TestAsyncDiskService.java   
/**
 * This test creates some ExampleTasks and runs them. 
 */
@Test
public void testAsyncDiskService() throws Throwable {

  String[] vols = new String[]{"/0", "/1"};
  AsyncDiskService service = new AsyncDiskService(vols);

  int total = 100;

  for (int i = 0; i < total; i++) {
    service.execute(vols[i%2], new ExampleTask());
  }

  Exception e = null;
  try {
    service.execute("no_such_volume", new ExampleTask());
  } catch (RuntimeException ex) {
    e = ex;
  }
  assertNotNull("Executing a task on a non-existing volume should throw an "
      + "Exception.", e);

  service.shutdown();
  if (!service.awaitTermination(5000)) {
    fail("AsyncDiskService didn't shutdown in 5 seconds.");
  }

  assertEquals(total, count);
}
项目:RDFS    文件:TestAsyncDiskService.java   
/**
 * This test creates some ExampleTasks and runs them. 
 */
public void testAsyncDiskService() throws Throwable {

  String[] vols = new String[]{"/0", "/1"};
  AsyncDiskService service = new AsyncDiskService(vols);

  int total = 100;

  for (int i = 0; i < total; i++) {
    service.execute(vols[i%2], new ExampleTask());
  }

  Exception e = null;
  try {
    service.execute("no_such_volume", new ExampleTask());
  } catch (RuntimeException ex) {
    e = ex;
  }
  assertNotNull("Executing a task on a non-existing volume should throw an "
      + "Exception.", e);

  service.shutdown();
  if (!service.awaitTermination(5000)) {
    fail("AsyncDiskService didn't shutdown in 5 seconds.");
  }

  assertEquals(total, count);
}