public static List<LoggedMqttMessage> parseMessageLog(final List<String> messages,final ProgressUpdater progress,final long current,final long max) throws SpyException {
  try {
    final long startTime=TimeUtils.getMonotonicTime();
    final int items=messages.size();
    final long chunkSize=items / 10;
    final MqttMessageLogParser parser=new MqttMessageLogParser();
    final List<LoggedMqttMessage> list=new ArrayList<LoggedMqttMessage>();
    long item=0;
    long reportAt=1;
    for (int i=0; i < items; i++) {
      final String message=messages.get(i);
      if (progress != null) {
        if (progress.isCancelled()) {
          logger.info("Task cancelled!");
          return null;
        }
        item++;
        if (item % 1000 == 0) {
          progress.update(current + item,max);
        }
      }
      if ((i > 0) && (i == (chunkSize * reportAt))) {
        final long currentTime=TimeUtils.getMonotonicTime();
        final long timeTaken=currentTime - startTime;
        final long totalTimeExpected=timeTaken * items / i;
        if (timeTaken > 1000) {
          logger.info("Processed {}%, estimated time left = {}s",reportAt * 10,(totalTimeExpected - timeTaken) / 1000);
        }
        reportAt++;
      }
      try {
        list.add(parser.parse(message));
      }
 catch (      XMLException e) {
        logger.error("Can't process message " + message,e);
      }
    }
    logger.info("Message audit log - parsed {} XML messages",list.size());
    return list;
  }
 catch (  XMLException e) {
    throw new SpyException("Can't parse the message audit log file",e);
  }
}

public static List < LoggedMqttMessage > parseMessageLog ( final List < String > messages , final ProgressUpdater progress , final long current , final long max ) throws SpyException { try { final long startTime = TimeUtils . getMonotonicTime ( ) ; final int items = messages . size ( ) ; final long chunkSize = items / 10 ; final MqttMessageLogParser parser = new MqttMessageLogParser ( ) ; final List < LoggedMqttMessage > list = new ArrayList < LoggedMqttMessage > ( ) ; long item = 0 ; long reportAt = 1 ; for ( int i = 0 ; i < items ; i ++ ) { final String message = messages . get ( i ) ; if ( progress != null ) { if ( progress . isCancelled ( ) ) { logger . info ( "Task cancelled!" ) ; return null ; } item ++ ; if ( item % 1000 == 0 ) { progress . update ( current + item , max ) ; } } if ( ( i > 0 ) && ( i == ( chunkSize * reportAt ) ) ) { final long currentTime = TimeUtils . getMonotonicTime ( ) ; final long timeTaken = currentTime - startTime ; final long totalTimeExpected = timeTaken * items / i ; if ( timeTaken > 1000 ) { logger . info ( "Processed {}%, estimated time left = {}s" , reportAt * 10 , ( totalTimeExpected - timeTaken ) / 1000 ) ; } reportAt ++ ; } try { list . add ( parser . parse ( message ) ) ; } catch ( XMLException e ) { logger . error ( "Can't process message " + message , e ) ; } } logger . info ( "Message audit log - parsed {} XML messages" , list . size ( ) ) ; return list ; } catch ( XMLException e ) { throw new SpyException ( "Can't parse the message audit log file" , e ) ; } }
parses the given list of xml messages into a list of mqtt message objects .
