本文整理汇总了Java中org.apache.hadoop.yarn.api.records.SerializedException.deSerialize方法的典型用法代码示例。如果您正苦于以下问题:Java SerializedException.deSerialize方法的具体用法?Java SerializedException.deSerialize怎么用?Java SerializedException.deSerialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.yarn.api.records.SerializedException
的用法示例。
在下文中一共展示了SerializedException.deSerialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSerializedExceptionDeSer
import org.apache.hadoop.yarn.api.records.SerializedException; //导入方法依赖的package包/类
@Test(timeout=10000)
public void testSerializedExceptionDeSer() throws Exception{
// without cause
YarnException yarnEx = new YarnException("Yarn_Exception");
SerializedException serEx = SerializedException.newInstance(yarnEx);
Throwable throwable = serEx.deSerialize();
Assert.assertEquals(yarnEx.getClass(), throwable.getClass());
Assert.assertEquals(yarnEx.getMessage(), throwable.getMessage());
// with cause
IOException ioe = new IOException("Test_IOException");
RuntimeException runtimeException =
new RuntimeException("Test_RuntimeException", ioe);
YarnException yarnEx2 =
new YarnException("Test_YarnException", runtimeException);
SerializedException serEx2 = SerializedException.newInstance(yarnEx2);
Throwable throwable2 = serEx2.deSerialize();
throwable2.printStackTrace();
Assert.assertEquals(yarnEx2.getClass(), throwable2.getClass());
Assert.assertEquals(yarnEx2.getMessage(), throwable2.getMessage());
Assert.assertEquals(runtimeException.getClass(), throwable2.getCause().getClass());
Assert.assertEquals(runtimeException.getMessage(), throwable2.getCause().getMessage());
Assert.assertEquals(ioe.getClass(), throwable2.getCause().getCause().getClass());
Assert.assertEquals(ioe.getMessage(), throwable2.getCause().getCause().getMessage());
}