sampleEnd called twice

Previous Topic Next Topic
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

sampleEnd called twice

Akos Gabriel

Problem description:
I have an MQ-based system which I would like to performance-test with the
following steps:

1. send JMS message to q1 (record its jms timestamp and messageId in a
2. message will be read by the app and replied into another queue,
correlationId set
3. read reply queue, find the correlated message and calculate roundtrip

1. and 3. are in separate thread groups, written in JSR223 Groovy

Code snippet:

     if (sendtime>0) {
      dt=recvtime - sendtime;" -> roundtrip time: "+dt);

roundtrip time (dt) is calculated correctly and logged.
However I would like to have graphs drawn about dt by JMeter.
I thought I would like to use this second sampler to draw the graphs.

But the last line of code causes the exception:

2020-04-22 21:49:40,809 ERROR o.a.j.s.SampleResult: sampleEnd called twice
java.lang.Throwable: Invalid call sequence

Please help me how to solve the problem.

Reply | Threaded
Open this post in threaded view

Re: sampleEnd called twice
The correct solution would be storing your *dt* into a JMeter Variable like:

> vars.put('dt', dt as String)

then you can declate this *dt* as a  Sample Variable
<>   and
generate a custom graph over
time out of it

If it's too complex you can update your JSR223 Sampler execution time from
the JSR223 PostProcessor like:

> prev.elapsedTime = vars.getObject('dt') as long

See  Top 8 JMeter Java Classes You Should Be Using with Groovy
article for more information regarding what these *vars* and *prev* stand
for and remember each time you bypass JMeter limitation using reflection
somewhere somehow a kitten dies.

Sent from:

To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]