@ Override public void run ( ) { try { ArchiveManager archives = new ArchiveManager ( ) ; ArticleReaderInterface articleReader = null ; ArchiveDescription description = null ; Task < Revision > task = null ; DiffCalculatorInterface diffCalc ; if ( MODE_STATISTICAL_OUTPUT ) { diffCalc = new TimedDiffCalculator ( new TaskTransmitter ( ) ) ; } else { diffCalc = new DiffCalculator ( new TaskTransmitter ( ) ) ; } long start , time ; while ( archives . hasArchive ( ) ) { // Retrieve Archive try { description = archives . getArchive ( ) ; // initialize filter ArticleFilter nameFilter = new ArticleFilter ( ) ; articleReader = InputFactory . getTaskReader ( description , nameFilter ) ; ArticleConsumerLogMessages . logArchiveRetrieved ( logger , description ) ; // Exception while accessing the archive } catch ( ArticleReaderException e ) { articleReader = null ; ArticleConsumerLogMessages . logExceptionRetrieveArchive ( logger , description , e ) ; } // Process Archive while ( articleReader != null ) { try { if ( articleReader . hasNext ( ) ) { start = System . currentTimeMillis ( ) ; //read the next article (may be null if filtered) task = articleReader . next ( ) ; time = System . currentTimeMillis ( ) - start ; // task will be null if the name filter removed that // article if ( task == null ) { continue ; } ArticleConsumerLogMessages . logArticleRead ( logger , task , time , articleReader . getBytePosition ( ) ) ; start = System . currentTimeMillis ( ) ; //calculate the diff for this article version diffCalc . process ( task ) ; time = System . currentTimeMillis ( ) - start ; DiffConsumerLogMessages . logArticleProcessed ( logger , task , time ) ; } else { ArticleConsumerLogMessages . logNoMoreArticles ( logger , description ) ; articleReader = null ; } // Reset current article } catch ( ArticleReaderException e ) { ArticleConsumerLogMessages . logTaskReaderException ( logger , e ) ; articleReader . resetTaskCompleted ( ) ; } catch ( DiffException e ) { DiffConsumerLogMessages . logDiffException ( logger , e ) ; articleReader . resetTaskCompleted ( ) ; diffCalc . reset ( ) ; } } } diffCalc . closeTransmitter ( ) ; ArticleConsumerLogMessages . logNoMoreArchives ( logger ) ; // Critical Exceptions } catch ( ConfigurationException e ) { DiffToolLogMessages . logException ( logger , e ) ; throw new RuntimeException ( e ) ; } catch ( UnsupportedEncodingException e ) { DiffToolLogMessages . logException ( logger , e ) ; throw new RuntimeException ( e ) ; } catch ( IOException e ) { DiffToolLogMessages . logException ( logger , e ) ; throw new RuntimeException ( e ) ; } catch ( TimeoutException e ) { DiffToolLogMessages . logException ( logger , e ) ; throw new RuntimeException ( e ) ; } catch ( Exception e ) { DiffToolLogMessages . logException ( logger , e ) ; throw new RuntimeException ( e ) ; } }
Runs the diff creation process