本文整理了Java中org.apache.hadoop.yarn.YarnUncaughtExceptionHandler.uncaughtException()
方法的一些代码示例,展示了YarnUncaughtExceptionHandler.uncaughtException()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnUncaughtExceptionHandler.uncaughtException()
方法的具体详情如下:
包路径:org.apache.hadoop.yarn.YarnUncaughtExceptionHandler
类名称: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!