Source:
public void run() { this.logger.fine( "Monitoring Task is being invoked." ); if( this.agentInterface.getRootInstance() == null) { this.logger.fine( "The agent's model has not yet been initialized. Monitoring cannot work yet." ); return; } for( Instance inst : InstanceHelpers.buildHierarchicalList( this.agentInterface.getRootInstance())) { File dir = InstanceHelpers.findInstanceDirectoryOnAgent( inst ); File measureFile = new File( dir, inst.getComponent().getName() + ".measures" ); if( ! measureFile.exists()) { this.logger.finer( "No file with measure rules was found for instance '" + inst + "'." ); continue; } this.logger.fine( "A file with measure rules was found for instance '" + inst + "'." ); String fileContent; try { fileContent = Utils.readFileContent( measureFile ); } catch( IOException e ) { this.logger.warning( "A problem occurred while reading the content for measure rules of instance '"+ inst + "'." ); Utils.logException( this.logger, e ); continue; } Properties params = null; File paramFile = new File( dir, inst.getComponent().getName() + ".measures.properties" ); if(paramFile.exists()) { this.logger.fine( "A file with measure parameters (properties) was found for instance '" + inst + "'." ); FileInputStream in = null; try { params = new Properties(); params.load((in = new FileInputStream(paramFile))); } catch(IOException e) { params = null; } finally { if(in != null) try { in.close(); } catch(Exception e) { } } } for( MonitoringHandler handler : extractRuleSections( measureFile, fileContent, params )) { try { Message msg = handler.process(); if( msg != null ) this.agentInterface.getMessagingClient().sendMessageToTheDm( msg ); } catch( IOException e ) { this.logger.warning( "A problem occurred while the agent monitoring was sending a message to the DM. " + e.getMessage()); Utils.logException( this.logger, e ); } } } }

Target:
public void run() { this.logger.fine( "Monitoring Task is being invoked." ); if( this.agentInterface.getRootInstance() == null) { this.logger.fine( "The agent's model has not yet been initialized. Monitoring cannot work yet." ); return; } for( Instance inst : InstanceHelpers.buildHierarchicalList( this.agentInterface.getRootInstance())) { File dir = InstanceHelpers.findInstanceDirectoryOnAgent( inst ); File measureFile = new File( dir, inst.getComponent().getName() + ".measures" ); if( ! measureFile.exists()) { this.logger.finer( "No file with measure rules was found for instance '" + inst + "'." ); continue; } this.logger.fine( "A file with measure rules was found for instance '" + inst + "'." ); String fileContent; try { fileContent = Utils.readFileContent( measureFile ); } catch( IOException e ) { this.logger.warning( "A problem occurred while reading the content for measure rules of instance '"+ inst + "'." ); Utils.logException( this.logger, e ); continue; } Properties params = null; File paramFile = new File( dir, inst.getComponent().getName() + ".measures.properties" ); if(paramFile.exists()) { this.logger.fine( "A file with measure parameters (properties) was found for instance '" + inst + "'." ); FileInputStream in = null; try { params = new Properties(); params.load((in = new FileInputStream(paramFile))); } catch(IOException e) { params = null; } finally { Utils.closeQuietly(in); } } for( MonitoringHandler handler : extractRuleSections( measureFile, fileContent, params )) { try { Message msg = handler.process(); if( msg != null ) this.agentInterface.getMessagingClient().sendMessageToTheDm( msg ); } catch( IOException e ) { this.logger.warning( "A problem occurred while the agent monitoring was sending a message to the DM. " + e.getMessage()); Utils.logException( this.logger, e ); } } } }