Exporter.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:activemq-cli-tools 作者:
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.getQueuePattern(), config.getTopicPattern());
            } else {
                appendKahaDbStore(xmlMarshaller, getKahaDbAdapter(config.getSource()),
                        config.getQueuePattern(), config.getTopicPattern());
            }

            xmlMarshaller.appendJournalClose(true);
        }

        long end = System.currentTimeMillis();

        LOG.info("Total export time: " + (end - start) + " ms");
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号