use of org.apache.tez.dag.recovery.records.RecoveryProtos.SummaryEventProto in project tez by apache.
the class TestHistoryEventsProtoConversion method testSummaryProtoConversion.
private HistoryEvent testSummaryProtoConversion(HistoryEvent historyEvent) throws IOException, TezException {
SummaryEvent event = (SummaryEvent) historyEvent;
ByteArrayOutputStream os = new ByteArrayOutputStream();
HistoryEvent deserializedEvent = null;
event.toSummaryProtoStream(os);
os.flush();
os.close();
LOG.info("Serialized event to byte array" + ", eventType=" + historyEvent.getEventType() + ", bufLen=" + os.toByteArray().length);
SummaryEventProto summaryEventProto = SummaryEventProto.parseDelimitedFrom(new ByteArrayInputStream(os.toByteArray()));
deserializedEvent = ReflectionUtils.createClazzInstance(event.getClass().getName());
((SummaryEvent) deserializedEvent).fromSummaryProtoStream(summaryEventProto);
return deserializedEvent;
}
Aggregations