use of co.cask.cdap.proto.BasicThrowable in project cdap by caskdata.
the class RemoteRuntimeStoreHandler method setStop.
@POST
@Path("/setStop")
public void setStop(HttpRequest request, HttpResponder responder) throws Exception {
Iterator<MethodArgument> arguments = parseArguments(request);
ProgramId program = deserializeNext(arguments);
String pid = deserializeNext(arguments);
long endTime = deserializeNext(arguments);
ProgramRunStatus runStatus = deserializeNext(arguments);
BasicThrowable failureCause = deserializeNext(arguments);
store.setStop(program, pid, endTime, runStatus, failureCause);
responder.sendStatus(HttpResponseStatus.OK);
}
use of co.cask.cdap.proto.BasicThrowable in project cdap by caskdata.
the class BasicThrowableCodec method deserialize.
@Override
public BasicThrowable deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
JsonObject jsonObj = json.getAsJsonObject();
String className = jsonObj.get("className").getAsString();
String message = jsonObj.get("message") == null ? null : jsonObj.get("message").getAsString();
JsonArray stackTraces = jsonObj.get("stackTraces").getAsJsonArray();
StackTraceElement[] stackTraceElements = context.deserialize(stackTraces, StackTraceElement[].class);
JsonElement cause = jsonObj.get("cause");
BasicThrowable basicThrowable = null;
if (cause != null) {
basicThrowable = context.deserialize(cause, BasicThrowable.class);
}
return new BasicThrowable(className, message, stackTraceElements, basicThrowable);
}
use of co.cask.cdap.proto.BasicThrowable in project cdap by caskdata.
the class BasicThrowableCodec method serialize.
@Override
public JsonElement serialize(BasicThrowable src, Type typeOfSrc, JsonSerializationContext context) {
JsonObject json = new JsonObject();
json.addProperty("className", src.getClassName());
json.addProperty("message", src.getMessage());
json.add("stackTraces", context.serialize(src.getStackTraces(), StackTraceElement[].class));
json.add("cause", context.serialize(src.getCause(), BasicThrowable.class));
return json;
}
Aggregations