if (payload instanceof NullPayload) {
// <start id="lis_12_context_statistics"/>
final AllStatistics allStatistics = muleContext.getStatistics();
allStatistics.logSummary(new XMLPrinter(xmlStatisticsWriter));
// <end id="lis_12_context_statistics"/>
} else {
final String flowName = payload.toString();
// <start id="lis_12_registry_flow_statistics"/>
final FlowConstruct flow = muleContext.getRegistry()
.lookupFlowConstruct(flowName);
FlowConstructStatistics flowStatistics = flow.getStatistics();
new XMLPrinter(xmlStatisticsWriter)
.print(Collections.singleton(flowStatistics));
// <end id="lis_12_registry_flow_statistics"/>
}
return xmlStatisticsWriter.toString();