in activemq-kahadb-exporter/src/main/java/org/apache/activemq/cli/kahadb/exporter/Exporter.java [147:174]
public static void exportStore(final ExportConfiguration config) throws Exception {
if (!config.isOverwrite() && config.getTarget().exists()) {
throw new IllegalStateException("File: " + config.getTarget() + " already exists");
}
long start = System.currentTimeMillis();
try(OutputStream fos = new BufferedOutputStream(config.isCompress() ? new GZIPOutputStream(
new FileOutputStream(config.getTarget())) : new FileOutputStream(config.getTarget()))) {
final XMLStreamWriter xmlWriter = XMLOutputFactory.newFactory().createXMLStreamWriter(fos);
final ArtemisJournalMarshaller xmlMarshaller = new ArtemisJournalMarshaller(xmlWriter);
xmlMarshaller.appendJournalOpen();
if (config.isMultiKaha()) {
appendMultiKahaDbStore(xmlMarshaller, getMultiKahaDbAdapter(config.getSource()), config);
} else {
appendKahaDbStore(xmlMarshaller, getKahaDbAdapter(config.getSource()), config);
}
xmlMarshaller.appendJournalClose(true);
}
long end = System.currentTimeMillis();
LOG.info("Total export time: " + (end - start) + " ms");
}