@ Override public void run ( ) { log . debug ( "HostProcess.run" ) ; try { hostProcessStartTime = System . currentTimeMillis ( ) ; // Initialise plugin factory to report the state of the plugins ASAP. pluginFactory . reset ( ) ; synchronized ( mapPluginStats ) { for ( Plugin plugin : pluginFactory . getPending ( ) ) { mapPluginStats . put ( plugin . getId ( ) , new PluginStats ( plugin . getName ( ) ) ) ; } } for ( StructuralNode startNode : startNodes ) { traverse ( startNode , true , node -> { if ( canScanNode ( node ) ) { messagesIdsToAppScan . add ( node . getHistoryReference ( ) . getHistoryId ( ) ) ; } } ) ; getAnalyser ( ) . start ( startNode ) ; } nodeInScopeCount = messagesIdsToAppScan . size ( ) ; if ( ! messagesIdsToAppScan . isEmpty ( ) ) { messageIdToHostScan = messagesIdsToAppScan . get ( 0 ) ; } logScanInfo ( ) ; Plugin plugin ; while ( ! isStop ( ) && pluginFactory . existPluginToRun ( ) ) { checkPause ( ) ; if ( isStop ( ) ) { break ; } plugin = pluginFactory . nextPlugin ( ) ; if ( plugin != null ) { plugin . setDelayInMs ( this . scannerParam . getDelayInMs ( ) ) ; plugin . setTechSet ( this . techSet ) ; processPlugin ( plugin ) ; } else { // waiting for dependency - no test ready yet Util . sleep ( 1000 ) ; } } threadPool . waitAllThreadComplete ( 300000 ) ; } catch ( Exception e ) { log . error ( "An error occurred while active scanning:" , e ) ; stop ( ) ; } finally { notifyHostProgress ( null ) ; notifyHostComplete ( ) ; getHttpSender ( ) . shutdown ( ) ; } }
Main execution method