1 package br.com.ibnetwork.guara.pipeline.valve.audit; 2 3 4 import org.apache.avalon.framework.configuration.Configurable; 5 import org.apache.avalon.framework.configuration.Configuration; 6 import org.apache.avalon.framework.configuration.ConfigurationException; 7 import org.apache.commons.logging.Log; 8 import org.apache.commons.logging.LogFactory; 9 10 import com.jamonapi.Monitor; 11 12 import br.com.ibnetwork.guara.pipeline.PipelineException; 13 import br.com.ibnetwork.guara.pipeline.valve.ValveSupport; 14 import br.com.ibnetwork.guara.rundata.RunData; 15 16 public class StopProfiler 17 extends ValveSupport 18 implements Configurable 19 { 20 private String label; 21 22 private Log logger; 23 24 public void configure(Configuration conf) 25 throws ConfigurationException 26 { 27 label = conf.getChild("profiler").getAttribute("label"); 28 logger = LogFactory.getLog(label); 29 } 30 31 protected boolean execute(RunData data) 32 throws PipelineException 33 { 34 Monitor mon = (Monitor) data.getContext().get(label); 35 if(mon != null) 36 { 37 mon.stop(); 38 logger.info(mon); 39 } 40 return true; 41 } 42 43 }