LoggingService loggingService = Aura.getLoggingService();
if (message == null) {
return;
}
List<Action> actions = message.getActions();
Json json = Json.createJsonStream(out, context.getJsonSerializationContext());
try {
json.writeMapBegin();
if (extras != null && extras.size() > 0) {
for (Map.Entry<?, ?> entry : extras.entrySet()) {
json.writeMapEntry(entry.getKey(), entry.getValue());
}
}
json.writeMapKey("actions");
json.writeArrayBegin();
run(actions, json);
json.writeArrayEnd();
loggingService.startTimer(LoggingService.TIMER_SERIALIZATION);
loggingService.startTimer(LoggingService.TIMER_SERIALIZATION_AURA);
try {
json.writeMapEntry("context", context);
List<Event> clientEvents = Aura.getContextService().getCurrentContext().getClientEvents();
if (clientEvents != null && !clientEvents.isEmpty()) {
json.writeMapEntry("events", clientEvents);
}
json.writeMapEnd();
} finally {
loggingService.stopTimer(LoggingService.TIMER_SERIALIZATION_AURA);
loggingService.stopTimer(LoggingService.TIMER_SERIALIZATION);
}
} finally {
json.close();
}
}