On 21/09/2007, Nikolaos Giannopoulos <[EMAIL PROTECTED]> wrote:
> sebb wrote:
> > Use a startup (init) file and define the variable there.
> >
> > Or you can use vars.putObject() - see the JavaDoc for the JMeterVariables 
> > class.
> >
> Ummm.... got it to work.  Only caveat is that I had to use 1 thread with
> anCounter i.e. threads that ran in parallel would have their own local
> vars variables.

Yes - JMeter variables are per-thread, as each thread represents an
independent user.

> So I take it there is no way to have true global variables i.e.
> variables whose values persist across threads.

No there aren't currently. Properties are global, but they can only be
used for storing strings.

Now the Counter Config can create global counters because its class is
shared between threads.

This suggests a work-round: functions are also shared between threads
- there is only one instance created for each occurrence of a function
in a test plan.

So you could use a BeanShell function. Create the Hash in the startup
file. Pass in the id, and the function can return the count of
entries. This can be used in an If Controller with Test Action sampler
as a child to stop the entire test.

Or indeed the function can ask JMeter to stop the threads directly:

ctx.getEngine().askThreadsToStop();

which is what TestAction does.

> Thanks Again for your help I got everything working!
>
> --Nikolaos
>
> > On 20/09/2007, Nikolaos Giannopoulos <[EMAIL PROTECTED]> wrote:
> >
> >> Hi,
> >>
> >> Working through most of the issues I had in developing a script that
> >> would ensure that I hit all 9 web instances behind a LB by processing a
> >> JSP that had the server and instance information.
> >>
> >> Last problem:
> >>
> >> - How do I create a global Hashtable variable
> >>   i.e. I can only add strings to the JMeter vars map
> >>   i.e. I want to create this global Hashtable once and have each thread
> >> simply add to it
> >>
> >> - Once I have 9 entries in the global Hashtable the threads will each
> >> start to stop and we are done
> >>
> >> Looks like a simple problem but vars doesn't work and I checked the
> >> JMeterContext class and it doesn't seem like you can add any object
> >> there either.  There must be a way to do this....
> >>
> >> Any ideas?
> >>
> >> --Nikolaos
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
>
>
> --
> Nikolaos Giannopoulos
> Director, BrightMinds Software Inc.
> e. [EMAIL PROTECTED]
> w. www.brightminds.org
> t. 1.613.822.1700
> f. 1.613.822.1915
> c. 1.613.797.0036
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to