You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by Philippe Mouawad <ph...@gmail.com> on 2012/10/10 23:38:56 UTC
Creating a Shared context between threads
Hello,
I was wondering if there is in JMeter a way to put an Object in a context
shared by all threads ?
Something like JMeterUtils.setProperty() but which would accept an Object
as value.
Wouldn't be interesting to have that ?
--
Cordialement.
Philippe Mouawad.
Re: Creating a Shared context between threads
Posted by Shmuel Krakower <sh...@gmail.com>.
Hmm I guess you are right. Just a suggestion.
I didnt like this either but you guys are the one who develop JMeter, I am
usually just working my way around until a feature or a bug gets developed,
as I don't count on my coding skills to make it into the clean JMeter code.
And I'm also too lazy.. ;)
בתאריך 2012 10 11 10:20, מאת "sebb" <se...@gmail.com>:
> On 11 October 2012 08:00, Shmuel Krakower <sh...@gmail.com> wrote:
> > How about the existing bsh.shared name space? I use it like this to even
> > share objects between thread groups in beanshell:
> >
> > MyClass UI = new MyClass();
> > // Saving object to allow using it later for cleanup in tearDown phase.
> > bsh.shared.UI = UI;
> >
>
> Yes, that does work, but adds quite a bit of overhead unless one
> actually needs to use BeanShell.
>
> Also it does not address the synchronisation issue.
>
> > Best,
> > Shmuel.
> >
> > On Wed, Oct 10, 2012 at 11:57 PM, Philippe Mouawad <
> > philippe.mouawad@gmail.com> wrote:
> >
> >> I agree with you.
> >>
> >> I was thinking of something like:
> >>
> >> - Loading a file in a setup Thread group which would contain a
> >> Map<String, List<String>> (ID to List of IDs map), groupID <=> IDs
> >> children
> >> of group in a parent/child hierarchy
> >> - And then in regular thread group access map by ID to get List of
> other
> >> ID and use them in a Loop Controller
> >>
> >>
> >> Use case emerged from here, but I am not saying it's the best solution
> to
> >> the case presented there:
> >>
> >> -
> >>
> >>
> http://stackoverflow.com/questions/12827079/read-a-string-from-a-file-with-a-dynamic-name-in-jmeter
> >>
> >>
> >> Regards
> >> Philippe
> >>
> >> On Wed, Oct 10, 2012 at 11:45 PM, sebb <se...@gmail.com> wrote:
> >>
> >> > On 10 October 2012 22:38, Philippe Mouawad <
> philippe.mouawad@gmail.com>
> >> > wrote:
> >> > > Hello,
> >> > > I was wondering if there is in JMeter a way to put an Object in a
> >> context
> >> > > shared by all threads ?
> >> > >
> >> > > Something like JMeterUtils.setProperty() but which would accept an
> >> Object
> >> > > as value.
> >> > >
> >> > > Wouldn't be interesting to have that ?
> >> >
> >> > The synchronisation issues would certainly be interesting ... what is
> >> > the use case?
> >> >
> >> > > --
> >> > > Cordialement.
> >> > > Philippe Mouawad.
> >> >
> >>
> >>
> >>
> >> --
> >> Cordialement.
> >> Philippe Mouawad.
> >>
>
Re: Creating a Shared context between threads
Posted by sebb <se...@gmail.com>.
On 11 October 2012 08:00, Shmuel Krakower <sh...@gmail.com> wrote:
> How about the existing bsh.shared name space? I use it like this to even
> share objects between thread groups in beanshell:
>
> MyClass UI = new MyClass();
> // Saving object to allow using it later for cleanup in tearDown phase.
> bsh.shared.UI = UI;
>
Yes, that does work, but adds quite a bit of overhead unless one
actually needs to use BeanShell.
Also it does not address the synchronisation issue.
> Best,
> Shmuel.
>
> On Wed, Oct 10, 2012 at 11:57 PM, Philippe Mouawad <
> philippe.mouawad@gmail.com> wrote:
>
>> I agree with you.
>>
>> I was thinking of something like:
>>
>> - Loading a file in a setup Thread group which would contain a
>> Map<String, List<String>> (ID to List of IDs map), groupID <=> IDs
>> children
>> of group in a parent/child hierarchy
>> - And then in regular thread group access map by ID to get List of other
>> ID and use them in a Loop Controller
>>
>>
>> Use case emerged from here, but I am not saying it's the best solution to
>> the case presented there:
>>
>> -
>>
>> http://stackoverflow.com/questions/12827079/read-a-string-from-a-file-with-a-dynamic-name-in-jmeter
>>
>>
>> Regards
>> Philippe
>>
>> On Wed, Oct 10, 2012 at 11:45 PM, sebb <se...@gmail.com> wrote:
>>
>> > On 10 October 2012 22:38, Philippe Mouawad <ph...@gmail.com>
>> > wrote:
>> > > Hello,
>> > > I was wondering if there is in JMeter a way to put an Object in a
>> context
>> > > shared by all threads ?
>> > >
>> > > Something like JMeterUtils.setProperty() but which would accept an
>> Object
>> > > as value.
>> > >
>> > > Wouldn't be interesting to have that ?
>> >
>> > The synchronisation issues would certainly be interesting ... what is
>> > the use case?
>> >
>> > > --
>> > > Cordialement.
>> > > Philippe Mouawad.
>> >
>>
>>
>>
>> --
>> Cordialement.
>> Philippe Mouawad.
>>
Re: Creating a Shared context between threads
Posted by Shmuel Krakower <sh...@gmail.com>.
How about the existing bsh.shared name space? I use it like this to even
share objects between thread groups in beanshell:
MyClass UI = new MyClass();
// Saving object to allow using it later for cleanup in tearDown phase.
bsh.shared.UI = UI;
Best,
Shmuel.
On Wed, Oct 10, 2012 at 11:57 PM, Philippe Mouawad <
philippe.mouawad@gmail.com> wrote:
> I agree with you.
>
> I was thinking of something like:
>
> - Loading a file in a setup Thread group which would contain a
> Map<String, List<String>> (ID to List of IDs map), groupID <=> IDs
> children
> of group in a parent/child hierarchy
> - And then in regular thread group access map by ID to get List of other
> ID and use them in a Loop Controller
>
>
> Use case emerged from here, but I am not saying it's the best solution to
> the case presented there:
>
> -
>
> http://stackoverflow.com/questions/12827079/read-a-string-from-a-file-with-a-dynamic-name-in-jmeter
>
>
> Regards
> Philippe
>
> On Wed, Oct 10, 2012 at 11:45 PM, sebb <se...@gmail.com> wrote:
>
> > On 10 October 2012 22:38, Philippe Mouawad <ph...@gmail.com>
> > wrote:
> > > Hello,
> > > I was wondering if there is in JMeter a way to put an Object in a
> context
> > > shared by all threads ?
> > >
> > > Something like JMeterUtils.setProperty() but which would accept an
> Object
> > > as value.
> > >
> > > Wouldn't be interesting to have that ?
> >
> > The synchronisation issues would certainly be interesting ... what is
> > the use case?
> >
> > > --
> > > Cordialement.
> > > Philippe Mouawad.
> >
>
>
>
> --
> Cordialement.
> Philippe Mouawad.
>
Re: Creating a Shared context between threads
Posted by Philippe Mouawad <ph...@gmail.com>.
I agree with you.
I was thinking of something like:
- Loading a file in a setup Thread group which would contain a
Map<String, List<String>> (ID to List of IDs map), groupID <=> IDs children
of group in a parent/child hierarchy
- And then in regular thread group access map by ID to get List of other
ID and use them in a Loop Controller
Use case emerged from here, but I am not saying it's the best solution to
the case presented there:
-
http://stackoverflow.com/questions/12827079/read-a-string-from-a-file-with-a-dynamic-name-in-jmeter
Regards
Philippe
On Wed, Oct 10, 2012 at 11:45 PM, sebb <se...@gmail.com> wrote:
> On 10 October 2012 22:38, Philippe Mouawad <ph...@gmail.com>
> wrote:
> > Hello,
> > I was wondering if there is in JMeter a way to put an Object in a context
> > shared by all threads ?
> >
> > Something like JMeterUtils.setProperty() but which would accept an Object
> > as value.
> >
> > Wouldn't be interesting to have that ?
>
> The synchronisation issues would certainly be interesting ... what is
> the use case?
>
> > --
> > Cordialement.
> > Philippe Mouawad.
>
--
Cordialement.
Philippe Mouawad.
Re: Creating a Shared context between threads
Posted by sebb <se...@gmail.com>.
On 10 October 2012 22:38, Philippe Mouawad <ph...@gmail.com> wrote:
> Hello,
> I was wondering if there is in JMeter a way to put an Object in a context
> shared by all threads ?
>
> Something like JMeterUtils.setProperty() but which would accept an Object
> as value.
>
> Wouldn't be interesting to have that ?
The synchronisation issues would certainly be interesting ... what is
the use case?
> --
> Cordialement.
> Philippe Mouawad.