本文整理汇总了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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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());
}
}
});
}
示例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);
}
});
}
示例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());
}
}
示例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());
}
});
}
示例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);
}
});
}
}
示例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);
}
});
}
示例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));
}
}
});
}
示例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();
}
});
}
}
示例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));
}
});
}
示例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();
}
});
}
示例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);
}
});
}
示例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();
}
});
}