AutomicLong used by two Feeders

21 просмотр
Перейти к первому непрочитанному сообщению

CyberNinja

не прочитано,
26 авг. 2016 г., 01:03:4226.08.2016
– Gatling User Group
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
next;
}))

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
curr;
}))

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

.feed(firstFeeder)
.exec(somethingThatUsesNext)
.feed(secondFeeder)
.exec(somethingThatUsesCurr)

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



CyberNinja

не прочитано,
30 авг. 2016 г., 02:21:2530.08.2016
– Gatling User Group
Any suggestions folks?

Stéphane LANDELLE

не прочитано,
1 сент. 2016 г., 09:19:1501.09.2016
– gat...@googlegroups.com
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.

Stéphane Landelle
GatlingCorp CEO


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений