[ 
https://issues.apache.org/jira/browse/UIMA-1476?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jerry Cwiklik closed UIMA-1476.
-------------------------------

    Resolution: Fixed

Fixed race condition that causes NullPointerException while initializing 
multiple Uima AS clients in the same JVM

> Fix race condition in the UIMA As client when creating a shared JMS connection
> ------------------------------------------------------------------------------
>
>                 Key: UIMA-1476
>                 URL: https://issues.apache.org/jira/browse/UIMA-1476
>             Project: UIMA
>          Issue Type: Bug
>          Components: Async Scaleout
>            Reporter: Jerry Cwiklik
>            Assignee: Jerry Cwiklik
>
> When scaling a UIMA AS client in the same JVM there is a race condition that 
> causes NullPointer exception. The exception is thrown when trying to access a 
> JMSConnection object that is not yet initialized. The problem is in the 
> setupConnection() method where the SharedConnection is initialized in two 
> steps:
> 1) Default constructor creates an instance of the SharedConnection
> 2) setConnection method is called with a new Connection object
> The problem is that the code in initialize() method checks if the 
> sharedConnection != null and if so proceeds to initializeProducer() method. 
> So the race condition is that SharedConnection constructor  finishes, a 
> thread sees that it is not null and calls initializeProducer BEFORE the 
> connection is set.
> Fix the code so that connection is passed in as an argument to a constructor 
> assuring that as soon as the SharedConnection is instantiated it is fully 
> initialized

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to