Klas wrote:

I've got a suggestion on an enhancement:

It's a good id� to give each Thread a number, since in many cases you 
want to log in (or create) many people with different userids (and 
passwords). We needed that for our wap-games so I added some code 
to the JMeterThread class:

    static int nbrThreads = 0; // used for assigning thread numbers
    private int thread_nbr = nbrThreads++; // used for identifying the Thread

and in the run()-method:

    SampleResult result = sampler.sample(entry);
    result.putValue("threadNbr", new Integer(thread_nbr)); // I added this 
line
    checkAssertions(entry, result);

Then I could fetch the threadNbr in my own class (a modified
AnchorModifier), and replace the value of parameters with the thread 
number (I used [nbr] as identifier for the number).

Me:

I was mainly looking at how to implement a callback so the the threads
could inform their caller when they are done (needs to be a callback
rather than a listener because the callback must be synchronized) so
I had thought to include the thread number in the constructor:

    for(int i = 0; i < threads.length; i++)
    {
        threads[i] = new JMeterThread(this, i+1, group);
        Thread newThread = new Thread(threads[i]);
        newThread.setName("JMeterThread-" + (i + 1));
        newThread.start();
    }

The threads then save their thread number.

The static variable method would not allow for multile runs, as each
run might not always be in the same VM. Or, GC might have kicked in,
in which case the static variable would be reset.

        My $.02
        


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

Reply via email to