Strange thing, I didn't notice your mail from wenesday, sorry :(

> How would that cause a problem?  The Map that holds the thread contexts
> is only being read, not written to.  So, many threads can ask for their
> context simultaneously, this should not be a problem.  Unless you can
> think of a scenario that is problematic?
>

Not exactly, because there is contextMap.get and then contextMap.put if 
context was null - classic test-and-set problem. But I was also partly wrong, 
because indeed the get and put works on the same context element in only one 
thread. 

But this is not all - Is the HashMap used in this class synchronized? I think 
it's not (HashTable is). So I think getContext should be synchronized anyway.


...
static private Map contextMap = new HashMap();
...
static public JMeterContext getContext()
    {
        init();
        JMeterContext context =
            (JMeterContext) contextMap.get(Thread.currentThread().getName());
        if (context == null)
        {
            context = new JMeterContext();
            setContext(context);
        }
        return context;
    }

In my problem (bug 27744) this was not the case. I fixed this bug and I'm 
going to commit the patch (It is in the bugzilla already but nobody tested 
it :(((
:))))
best regards,
Michał Kostrzewa

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

Reply via email to