Bug 61674 - Introduce global Variables shared accross threads
Summary: Introduce global Variables shared accross threads
Status: NEW
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 3.3
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
Depends on:
Reported: 2017-10-27 07:07 UTC by Philippe Mouawad
Modified: 2017-10-27 10:58 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Mouawad 2017-10-27 07:07:11 UTC
There is frequently the need in Load Testing for sharing something accross threads which might have been initialized in a setup Thread Group or by some Thread.

Currently JMeter has 2 ways to do it:

- Properties but they are limited to String
- Through Beanshell (which is deprecated) through bsh.shared

A recent illustration of this is the Coverage Tests created for JMS, TCP and FTP.
To do it we had to use Beanshell.

So after discussion:
- http://mail-archives.apache.org/mod_mbox/jmeter-dev/201710.mbox/%3CCAH9fUpY3jEb%3D_Oa-fuf-RFuSUz2Nop5ix7%2BnPzy-yVc7C47_JA%40mail.gmail.com%3E

This would be introduced this way:

- any variable starting with "global:" is global
- JMeterVariables class modification, which would delegate all variables with "global:" prefix into global thread-safe map.
- The Map would be ConcurrentMap
- It would be initialized/cleared in StandardJMeterEngine#run or JMeterContextService.startTest();

See dev discussion:
Comment 1 Sebb 2017-10-27 10:58:52 UTC
This will affect any test which happens to use the global: prefix.

Might be better to use a less likely prefix such as __G__

In any case if it is implemented the release notes need to make the change in behaviour very clear.