当前位置: 首页>>代码示例>>Java>>正文


Java JMeterUtils.runSafe方法代码示例

本文整理汇总了Java中org.apache.jmeter.util.JMeterUtils.runSafe方法的典型用法代码示例。如果您正苦于以下问题:Java JMeterUtils.runSafe方法的具体用法?Java JMeterUtils.runSafe怎么用?Java JMeterUtils.runSafe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jmeter.util.JMeterUtils的用法示例。


在下文中一共展示了JMeterUtils.runSafe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addDivider

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/**
 * Helper method to add a Divider
 * Called from Application Thread that needs to update GUI (JMeterTreeModel)
 */
private void addDivider(final JMeterTreeModel model, final JMeterTreeNode node) {
    final GenericController sc = new GenericController();
    sc.setProperty(TestElement.GUI_CLASS, LOGIC_CONTROLLER_GUI);
    sc.setName("-------------------"); // $NON-NLS-1$
    JMeterUtils.runSafe(new Runnable() {
        @Override
        public void run() {
            try {
                model.addComponent(sc, node);
            } catch (IllegalUserActionException e) {
                log.error("Program error", e);
                throw new Error(e);
            }
        }
    });
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:21,代码来源:ProxyControl.java

示例2: addSimpleController

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/**
 * Helper method to add a Simple Controller to contain the samplers.
 * Called from Application Thread that needs to update GUI (JMeterTreeModel)
 * @param model
 *            Test component tree model
 * @param node
 *            Node in the tree where we will add the Controller
 * @param name
 *            A name for the Controller
 * @throws InvocationTargetException
 * @throws InterruptedException
 */
private void addSimpleController(final JMeterTreeModel model, final JMeterTreeNode node, String name)
        throws InterruptedException, InvocationTargetException {
    final GenericController sc = new GenericController();
    sc.setProperty(TestElement.GUI_CLASS, LOGIC_CONTROLLER_GUI);
    sc.setName(name);
    JMeterUtils.runSafe(new Runnable() {
        @Override
        public void run() {
            try {
                model.addComponent(sc, node);
            } catch (IllegalUserActionException e) {
                 log.error("Program error", e);
                 throw new Error(e);
            }
        }
    });
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:30,代码来源:ProxyControl.java

示例3: addTransactionController

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/**
 * Helper method to add a Transaction Controller to contain the samplers.
 * Called from Application Thread that needs to update GUI (JMeterTreeModel)
 * @param model
 *            Test component tree model
 * @param node
 *            Node in the tree where we will add the Controller
 * @param name
 *            A name for the Controller
 * @throws InvocationTargetException
 * @throws InterruptedException
 */
private void addTransactionController(final JMeterTreeModel model, final JMeterTreeNode node, String name)
        throws InterruptedException, InvocationTargetException {
    final TransactionController sc = new TransactionController();
    sc.setIncludeTimers(false);
    sc.setProperty(TestElement.GUI_CLASS, TRANSACTION_CONTROLLER_GUI);
    sc.setName(name);
    JMeterUtils.runSafe(new Runnable() {
        @Override
        public void run() {
             try {
                model.addComponent(sc, node);
            } catch (IllegalUserActionException e) {
                log.error("Program error", e);
                throw new Error(e);
            }
        }
    });
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:31,代码来源:ProxyControl.java

示例4: add

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@Override
public void add(SampleResult sample) {
    final StringBuilder sb = new StringBuilder(100);
    sb.append(sample.getSampleLabel());
    sb.append(getAssertionResult(sample));
    sb.append("\n"); // $NON-NLS-1$
    JMeterUtils.runSafe(new Runnable() {
        @Override
        public void run() {
            synchronized (textArea) {
                textArea.append(sb.toString());
                textArea.setCaretPosition(textArea.getText().length());
            }                
        }
    });
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:17,代码来源:AssertionVisualizer.java

示例5: add

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void add(final SampleResult sample) {
    JMeterUtils.runSafe(false, new Runnable() {
        @Override
        public void run() {
            updateGui(sample);
        }
    });
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:11,代码来源:ViewResultsFullVisualizer.java

示例6: placeSampler

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
private void placeSampler(final HTTPSamplerBase sampler, final TestElement[] subConfigs, final TestElement myTarget)
{
    try
    {
        JMeterUtils.runSafe(() -> myTarget.addTestElement(sampler));
    }
    catch (Exception e)
    {
        JMeterUtils.reportErrorToUser(e.getMessage());
    }
}
 
开发者ID:d0k1,项目名称:jsflight,代码行数:12,代码来源:JMeterProxyControl.java

示例7: add

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@Override
public void add(final SampleResult res) {
    JMeterUtils.runSafe(new Runnable() {
        @Override
        public void run() {
            // made currentSample volatile
            model.addSample(res);
            updateGui(model.getCurrentSample());                
        }
    });
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:12,代码来源:DistributionGraphVisualizer.java

示例8: add

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@Override
public void add(final SampleResult res) {
    if (getModel() != null) {
        JMeterUtils.runSafe(new Runnable() {
            @Override
            public void run() {
                MailerModel model = ((MailerResultCollector) getModel()).getMailerModel();
                // method called by add is synchronized
                model.add(res);//this is a different model from the one used by the result collector
                updateVisualizer(model);                    
            }
        });
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:15,代码来源:MailerVisualizer.java

示例9: add

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@Override
public void add(final SampleResult res) {
    JMeterUtils.runSafe(new Runnable() {            
        @Override
        public void run() {
            model.add(res);
        }
    });
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:10,代码来源:SplineVisualizer.java

示例10: add

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@Override
public void add(final SampleResult res) {
    JMeterUtils.runSafe(new Runnable() {
        @Override
        public void run() {
            if (childSamples.isSelected()) {
                SampleResult[] subResults = res.getSubResults();
                if (subResults.length > 0) {
                    for (SampleResult sr : subResults) {
                        add(sr);
                    }
                    return;
                }
            }
            synchronized (calc) {
                calc.addSample(res);
                int count = calc.getCount();
                TableSample newS = new TableSample(
                        count, 
                        res.getSampleCount(), 
                        res.getStartTime(), 
                        res.getThreadName(), 
                        res.getSampleLabel(),
                        res.getTime(),
                        res.isSuccessful(),
                        res.getBytes(),
                        res.getLatency());
                model.addRow(newS);
            }
            updateTextFields(res);
            if (autoscroll.isSelected()) {
                table.scrollRectToVisible(table.getCellRect(table.getRowCount() - 1, 0, true));
            }
        }
    });
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:37,代码来源:TableVisualizer.java

示例11: add

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@Override
public void add(final SampleResult res) {
    final String sampleLabel = res.getSampleLabel();
    // Sampler selection
    if (columnSelection.isSelected() && pattern != null) {
        matcher = pattern.matcher(sampleLabel);
    }
    if ((matcher == null) || (matcher.find())) {
        JMeterUtils.runSafe(new Runnable() {
            @Override
            public void run() {
                SamplingStatCalculator row = null;
                synchronized (lock) {
                    row = tableRows.get(sampleLabel);
                    if (row == null) {
                        row = new SamplingStatCalculator(sampleLabel);
                        tableRows.put(row.getLabel(), row);
                        model.insertRow(row, model.getRowCount() - 1);
                    }
                }
                row.addSample(res);
                tableRows.get(TOTAL_ROW_LABEL).addSample(res);
                model.fireTableDataChanged();                    
            }
        });
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:28,代码来源:StatGraphVisualizer.java

示例12: add

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@Override
public void add(final SampleResult res) {
    JMeterUtils.runSafe(new Runnable() {            
        @Override
        public void run() {
            updateGui(model.addSample(res));
        }
    });
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:10,代码来源:GraphVisualizer.java

示例13: add

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@Override
public void add(final SampleResult res) {
    final String sampleLabel = res.getSampleLabel(useGroupName.isSelected());
    JMeterUtils.runSafe(new Runnable() {
        @Override
        public void run() {
            Calculator row = null;
            synchronized (lock) {
                row = tableRows.get(sampleLabel);
                if (row == null) {
                    row = new Calculator(sampleLabel);
                    tableRows.put(row.getLabel(), row);
                    model.insertRow(row, model.getRowCount() - 1);
                }
            }
            /*
             * Synch is needed because multiple threads can update the counts.
             */
            synchronized(row) {
                row.addSample(res);
            }
            Calculator tot = tableRows.get(TOTAL_ROW_LABEL);
            synchronized(tot) {
                tot.addSample(res);
            }
            model.fireTableDataChanged();                
        }
    });
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:30,代码来源:SummaryReport.java

示例14: add

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void add(final SampleResult sample) {
    JMeterUtils.runSafe(new Runnable() {
        @Override
        public void run() {
            updateGui(sample);
        }
    });
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:11,代码来源:ViewResultsFullVisualizer.java

示例15: add

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@Override
public void add(final SampleResult res) {
    JMeterUtils.runSafe(new Runnable() {
        @Override
        public void run() {
            SamplingStatCalculator row = null;
            final String sampleLabel = res.getSampleLabel(useGroupName.isSelected());
            synchronized (lock) {
                row = tableRows.get(sampleLabel);
                if (row == null) {
                    row = new SamplingStatCalculator(sampleLabel);
                    tableRows.put(row.getLabel(), row);
                    model.insertRow(row, model.getRowCount() - 1);
                }
            }
            /*
             * Synch is needed because multiple threads can update the counts.
             */
            synchronized(row) {
                row.addSample(res);
            }
            SamplingStatCalculator tot = tableRows.get(TOTAL_ROW_LABEL);
            synchronized(tot) {
                tot.addSample(res);
            }
            model.fireTableDataChanged();                
        }
    });
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:30,代码来源:StatVisualizer.java


注:本文中的org.apache.jmeter.util.JMeterUtils.runSafe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。