AutomicLong used by two Feeders

Hi All,

An AutomicLong val (idSequence) in my simulation is used by two feeders. FirstFeeder increments the value and uses it.
SecondFeeder needs to use it as it is and this value needs to be same as the one used by FirstFeeder. This is currently not happening because idSequence will be used by other users in the test. So i get different values is both feeders.
Is there any way to get this working?


val idSequence = new AtomicLong(0);

//in ‘before’ hook, idSequence is loaded with a Long value from a file

val firstFeeder = Iterator.continually(Map(“first” → {
var next: Long = idSequence.incrementAndGet()
// do some processing on next and return

val secondFeeder = Iterator.continually(Map(“second” → {
var curr: Long = idSequence.get() //this doesn’t return correct value because idSequence is also used by other users
// do some processing on curr and return


//in my scenario(), the feeders are fed like this


//in ‘after’ hook, once test is finished, the last used idSequence is written back to the file to use for next execution


Any suggestions folks?

A feeder is a shared datasource.
If you want a per user counters, don’t use a feeder and store those counters in each virtual user’s session.