Paul Hammant created JBEHAVE-756:
------------------------------------

             Summary: ParameterConverters not threadsafe
                 Key: JBEHAVE-756
                 URL: https://jira.codehaus.org/browse/JBEHAVE-756
             Project: JBehave
          Issue Type: Bug
          Components: Core
            Reporter: Paul Hammant
            Assignee: Paul Hammant
            Priority: Minor
             Fix For: 3.6.1


Jeff Caswell's patch applied:

We have been having a number of issues with story parameter conversion and  
number format errors in a multithreaded environment.

This was tracked back to the java.text.NumberFormat instance held by the 
ParameterConverters NumberConverter inner class.

The constructor is only run once when a number of stories are launched and the 
instance is used by all the stories in the run.

I suspect there may be other issues affecting this, however by converting the 
NumberFormat to ThreadLocal storage has solved the problem here.

The patch is pretty much self explanitory, the only aspect that may not 
immediately seem obvious is that the NumberFormat passed in on the constructor 
was itself constructed with the users preferred Locale. It is for this reason 
that I have treated it as the 'preferred format' and cloned it for the thread 
local copy. Also I did not issue an explicit remove since tests are run as a 
relatively short lived batch job and I did not feel that there was any reason 
to worry about an associated memory leak.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to