Search in sources :

Example 1 with SerializedExceptionProtoOrBuilder

use of org.apache.hadoop.yarn.proto.YarnProtos.SerializedExceptionProtoOrBuilder in project hadoop by apache.

the class SerializedExceptionPBImpl method deSerialize.

@SuppressWarnings("unchecked")
@Override
public Throwable deSerialize() {
    SerializedException cause = getCause();
    SerializedExceptionProtoOrBuilder p = viaProto ? proto : builder;
    Class<?> realClass = null;
    try {
        realClass = Class.forName(p.getClassName());
    } catch (ClassNotFoundException e) {
        throw new YarnRuntimeException(e);
    }
    Class classType = null;
    if (YarnException.class.isAssignableFrom(realClass)) {
        classType = YarnException.class;
    } else if (IOException.class.isAssignableFrom(realClass)) {
        classType = IOException.class;
    } else if (RuntimeException.class.isAssignableFrom(realClass)) {
        classType = RuntimeException.class;
    } else {
        classType = Throwable.class;
    }
    return instantiateException(realClass.asSubclass(classType), getMessage(), cause == null ? null : cause.deSerialize());
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) SerializedException(org.apache.hadoop.yarn.api.records.SerializedException) IOException(java.io.IOException) SerializedExceptionProtoOrBuilder(org.apache.hadoop.yarn.proto.YarnProtos.SerializedExceptionProtoOrBuilder)

Aggregations

IOException (java.io.IOException)1 SerializedException (org.apache.hadoop.yarn.api.records.SerializedException)1 YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)1 SerializedExceptionProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnProtos.SerializedExceptionProtoOrBuilder)1