@Override public void sampleOccurred(SampleEvent e) { if (sampleListener != null) { sampleListener.sampleOccurred(e); } }
/** * A sample has started. */ @Override public void sampleStarted(SampleEvent e) { if (sampleListener != null) { sampleListener.sampleStarted(e); } }
/** * A sample has stopped. */ @Override public void sampleStopped(SampleEvent e) { if (sampleListener != null) { sampleListener.sampleStopped(e); } } }
/** * This method is called remotely and fires a list of samples events * received locally. The function is to reduce network load when using * remote testing. * * @param samples * the list of sample events to be fired locally */ @Override public void processBatch(List<SampleEvent> samples) { if (samples != null && sampleListener != null) { for (SampleEvent e : samples) { sampleListener.sampleOccurred(e); } } }
/** * Notify a list of listeners that a sample has occurred. * * @param res * the sample event that has occurred. Must be non-null. * @param listeners * a list of the listeners which should be notified. This list * must not be null and must contain only SampleListener * elements. */ public void notifyListeners(SampleEvent res, List<SampleListener> listeners) { for (SampleListener sampleListener : listeners) { try { TestBeanHelper.prepare((TestElement) sampleListener); sampleListener.sampleOccurred(res); } catch (RuntimeException e) { log.error("Detected problem in Listener.", e); log.info("Continuing to process further listeners"); } } }
/** * This will notify sample listeners directly within the Proxy of the * sampling that just occurred -- so that we have a means to record the * server's responses as we go. * * @param event * sampling event to be delivered */ private void notifySampleListeners(SampleEvent event) { JMeterTreeModel treeModel = getJmeterTreeModel(); JMeterTreeNode myNode = treeModel.getNodeOf(this); if(myNode != null) { Enumeration<?> kids = myNode.children(); while (kids.hasMoreElements()) { JMeterTreeNode subNode = (JMeterTreeNode)kids.nextElement(); if (subNode.isEnabled()) { TestElement testElement = subNode.getTestElement(); if (testElement instanceof SampleListener) { ((SampleListener) testElement).sampleOccurred(event); } } } } }