protected HashMap<Integer,AtomicInteger> internalCountJournalLivingRecords(Configuration config,boolean messageJournal) throws Exception {
  final HashMap<Integer,AtomicInteger> recordsType=new HashMap<>();
  SequentialFileFactory ff;
  JournalImpl journal;
  if (messageJournal) {
    ff=new NIOSequentialFileFactory(config.getJournalLocation(),null,1);
    journal=new JournalImpl(config.getJournalFileSize(),config.getJournalMinFiles(),config.getJournalPoolFiles(),0,0,ff,"activemq-data","amq",1);
  }
 else {
    ff=new NIOSequentialFileFactory(config.getBindingsLocation(),null,1);
    journal=new JournalImpl(1024 * 1024,2,config.getJournalCompactMinFiles(),config.getJournalPoolFiles(),config.getJournalCompactPercentage(),ff,"activemq-bindings","bindings",1);
  }
  journal.start();
  final List<RecordInfo> committedRecords=new LinkedList<>();
  final List<PreparedTransactionInfo> preparedTransactions=new LinkedList<>();
  journal.load(committedRecords,preparedTransactions,null,false);
  for (  RecordInfo info : committedRecords) {
    Integer ikey=new Integer(info.getUserRecordType());
    AtomicInteger value=recordsType.get(ikey);
    if (value == null) {
      value=new AtomicInteger();
      recordsType.put(ikey,value);
    }
    value.incrementAndGet();
  }
  journal.stop();
  return recordsType;
}

protected HashMap < Integer , AtomicInteger > internalCountJournalLivingRecords ( Configuration config , boolean messageJournal ) throws Exception { final HashMap < Integer , AtomicInteger > recordsType = new HashMap < > ( ) ; SequentialFileFactory ff ; JournalImpl journal ; if ( messageJournal ) { ff = new NIOSequentialFileFactory ( config . getJournalLocation ( ) , null , 1 ) ; journal = new JournalImpl ( config . getJournalFileSize ( ) , config . getJournalMinFiles ( ) , config . getJournalPoolFiles ( ) , 0 , 0 , ff , "activemq-data" , "amq" , 1 ) ; } else { ff = new NIOSequentialFileFactory ( config . getBindingsLocation ( ) , null , 1 ) ; journal = new JournalImpl ( 1024 * 1024 , 2 , config . getJournalCompactMinFiles ( ) , config . getJournalPoolFiles ( ) , config . getJournalCompactPercentage ( ) , ff , "activemq-bindings" , "bindings" , 1 ) ; } journal . start ( ) ; final List < RecordInfo > committedRecords = new LinkedList < > ( ) ; final List < PreparedTransactionInfo > preparedTransactions = new LinkedList < > ( ) ; journal . load ( committedRecords , preparedTransactions , null , false ) ; for ( RecordInfo info : committedRecords ) { Integer ikey = new Integer ( info . getUserRecordType ( ) ) ; AtomicInteger value = recordsType . get ( ikey ) ; if ( value == null ) { value = new AtomicInteger ( ) ; recordsType . put ( ikey , value ) ; } value . incrementAndGet ( ) ; } journal . stop ( ) ; return recordsType ; }
this method will load a journal and count the living records
