gpt4 book ai didi

org.apache.hadoop.yarn.YarnUncaughtExceptionHandler.uncaughtException()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 09:18:40 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.yarn.YarnUncaughtExceptionHandler.uncaughtException()方法的一些代码示例,展示了YarnUncaughtExceptionHandler.uncaughtException()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnUncaughtExceptionHandler.uncaughtException()方法的具体详情如下:
包路径:org.apache.hadoop.yarn.YarnUncaughtExceptionHandler
类名称:YarnUncaughtExceptionHandler
方法名:uncaughtException

YarnUncaughtExceptionHandler.uncaughtException介绍

暂无

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common

/**
  * <p>
  * Throw {@code OutOfMemoryError} inside thread and
  * check {@code YarnUncaughtExceptionHandler} instance
  * <p>
  * Used {@code ExitUtil} class to avoid jvm exit through
  * {@code Runtime.getRuntime().halt(-1)}
  *
  * @throws InterruptedException
  */
 @Test
 public void testUncaughtExceptionHandlerWithOutOfMemoryError()
   throws InterruptedException {
  ExitUtil.disableSystemHalt();
  final YarnUncaughtExceptionHandler spyOomHandler = spy(exHandler);
  final OutOfMemoryError oomError = new OutOfMemoryError("out-of-memory-error");
  final Thread oomThread = new Thread(new Runnable() {
   @Override
   public void run() {
    throw oomError;
   }
  });
  oomThread.setUncaughtExceptionHandler(spyOomHandler);
  assertSame(spyOomHandler, oomThread.getUncaughtExceptionHandler());
  oomThread.start();
  oomThread.join();
  verify(spyOomHandler).uncaughtException(oomThread, oomError);
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common

/**
 * Throw {@code YarnRuntimeException} inside thread and
 * check {@code YarnUncaughtExceptionHandler} instance
 *
 * @throws InterruptedException
 */
@Test
public void testUncaughtExceptionHandlerWithRuntimeException()
  throws InterruptedException {
 final YarnUncaughtExceptionHandler spyYarnHandler = spy(exHandler);
 final YarnRuntimeException yarnException = new YarnRuntimeException(
   "test-yarn-runtime-exception");
 final Thread yarnThread = new Thread(new Runnable() {
  @Override
  public void run() {
   throw yarnException;
  }
 });
 yarnThread.setUncaughtExceptionHandler(spyYarnHandler);
 assertSame(spyYarnHandler, yarnThread.getUncaughtExceptionHandler());
 yarnThread.start();
 yarnThread.join();
 verify(spyYarnHandler).uncaughtException(yarnThread, yarnException);
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common

/**
 * Throw {@code YarnRuntimeException} inside thread and
 * check {@code YarnUncaughtExceptionHandler} instance
 *
 * @throws InterruptedException
 */
@Test
public void testUncaughtExceptionHandlerWithRuntimeException()
  throws InterruptedException {
 final YarnUncaughtExceptionHandler spyYarnHandler = spy(exHandler);
 final YarnRuntimeException yarnException = new YarnRuntimeException(
   "test-yarn-runtime-exception");
 final Thread yarnThread = new Thread(new Runnable() {
  @Override
  public void run() {
   throw yarnException;
  }
 });
 yarnThread.setUncaughtExceptionHandler(spyYarnHandler);
 assertSame(spyYarnHandler, yarnThread.getUncaughtExceptionHandler());
 yarnThread.start();
 yarnThread.join();
 verify(spyYarnHandler).uncaughtException(yarnThread, yarnException);
}

代码示例来源:origin: io.hops/hadoop-yarn-common

/**
 * Throw {@code YarnRuntimeException} inside thread and
 * check {@code YarnUncaughtExceptionHandler} instance
 *
 * @throws InterruptedException
 */
@Test
public void testUncaughtExceptionHandlerWithRuntimeException()
  throws InterruptedException {
 final YarnUncaughtExceptionHandler spyYarnHandler = spy(exHandler);
 final YarnRuntimeException yarnException = new YarnRuntimeException(
   "test-yarn-runtime-exception");
 final Thread yarnThread = new Thread(new Runnable() {
  @Override
  public void run() {
   throw yarnException;
  }
 });
 yarnThread.setUncaughtExceptionHandler(spyYarnHandler);
 assertSame(spyYarnHandler, yarnThread.getUncaughtExceptionHandler());
 yarnThread.start();
 yarnThread.join();
 verify(spyYarnHandler).uncaughtException(yarnThread, yarnException);
}

代码示例来源:origin: io.hops/hadoop-yarn-common

/**
  * <p>
  * Throw {@code OutOfMemoryError} inside thread and
  * check {@code YarnUncaughtExceptionHandler} instance
  * <p>
  * Used {@code ExitUtil} class to avoid jvm exit through
  * {@code Runtime.getRuntime().halt(-1)}
  *
  * @throws InterruptedException
  */
 @Test
 public void testUncaughtExceptionHandlerWithOutOfMemoryError()
   throws InterruptedException {
  ExitUtil.disableSystemHalt();
  final YarnUncaughtExceptionHandler spyOomHandler = spy(exHandler);
  final OutOfMemoryError oomError = new OutOfMemoryError("out-of-memory-error");
  final Thread oomThread = new Thread(new Runnable() {
   @Override
   public void run() {
    throw oomError;
   }
  });
  oomThread.setUncaughtExceptionHandler(spyOomHandler);
  assertSame(spyOomHandler, oomThread.getUncaughtExceptionHandler());
  oomThread.start();
  oomThread.join();
  verify(spyOomHandler).uncaughtException(oomThread, oomError);
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common

/**
 * <p>
 * Throw {@code Error} inside thread and
 * check {@code YarnUncaughtExceptionHandler} instance
 * <p>
 * Used {@code ExitUtil} class to avoid jvm exit through
 * {@code System.exit(-1) }
 *
 * @throws InterruptedException
 */
@Test
public void testUncaughtExceptionHandlerWithError()
  throws InterruptedException {
 ExitUtil.disableSystemExit();
 final YarnUncaughtExceptionHandler spyErrorHandler = spy(exHandler);
 final java.lang.Error error = new java.lang.Error("test-error");
 final Thread errorThread = new Thread(new Runnable() {
  @Override
  public void run() {
   throw error;
  }
 });
 errorThread.setUncaughtExceptionHandler(spyErrorHandler);
 assertSame(spyErrorHandler, errorThread.getUncaughtExceptionHandler());
 errorThread.start();
 errorThread.join();
 verify(spyErrorHandler).uncaughtException(errorThread, error);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common

/**
 * <p>
 * Throw {@code Error} inside thread and
 * check {@code YarnUncaughtExceptionHandler} instance
 * <p>
 * Used {@code ExitUtil} class to avoid jvm exit through
 * {@code System.exit(-1) }
 *
 * @throws InterruptedException
 */
@Test
public void testUncaughtExceptionHandlerWithError()
  throws InterruptedException {
 ExitUtil.disableSystemExit();
 final YarnUncaughtExceptionHandler spyErrorHandler = spy(exHandler);
 final java.lang.Error error = new java.lang.Error("test-error");
 final Thread errorThread = new Thread(new Runnable() {
  @Override
  public void run() {
   throw error;
  }
 });
 errorThread.setUncaughtExceptionHandler(spyErrorHandler);
 assertSame(spyErrorHandler, errorThread.getUncaughtExceptionHandler());
 errorThread.start();
 errorThread.join();
 verify(spyErrorHandler).uncaughtException(errorThread, error);
}

代码示例来源:origin: io.hops/hadoop-yarn-common

/**
 * <p>
 * Throw {@code Error} inside thread and
 * check {@code YarnUncaughtExceptionHandler} instance
 * <p>
 * Used {@code ExitUtil} class to avoid jvm exit through
 * {@code System.exit(-1) }
 *
 * @throws InterruptedException
 */
@Test
public void testUncaughtExceptionHandlerWithError()
  throws InterruptedException {
 ExitUtil.disableSystemExit();
 final YarnUncaughtExceptionHandler spyErrorHandler = spy(exHandler);
 final java.lang.Error error = new java.lang.Error("test-error");
 final Thread errorThread = new Thread(new Runnable() {
  @Override
  public void run() {
   throw error;
  }
 });
 errorThread.setUncaughtExceptionHandler(spyErrorHandler);
 assertSame(spyErrorHandler, errorThread.getUncaughtExceptionHandler());
 errorThread.start();
 errorThread.join();
 verify(spyErrorHandler).uncaughtException(errorThread, error);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common

/**
  * <p>
  * Throw {@code OutOfMemoryError} inside thread and
  * check {@code YarnUncaughtExceptionHandler} instance
  * <p>
  * Used {@code ExitUtil} class to avoid jvm exit through
  * {@code Runtime.getRuntime().halt(-1)}
  *
  * @throws InterruptedException
  */
 @Test
 public void testUncaughtExceptionHandlerWithOutOfMemoryError()
   throws InterruptedException {
  ExitUtil.disableSystemHalt();
  final YarnUncaughtExceptionHandler spyOomHandler = spy(exHandler);
  final OutOfMemoryError oomError = new OutOfMemoryError("out-of-memory-error");
  final Thread oomThread = new Thread(new Runnable() {
   @Override
   public void run() {
    throw oomError;
   }
  });
  oomThread.setUncaughtExceptionHandler(spyOomHandler);
  assertSame(spyOomHandler, oomThread.getUncaughtExceptionHandler());
  oomThread.start();
  oomThread.join();
  verify(spyOomHandler).uncaughtException(oomThread, oomError);
 }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com