[
https://issues.apache.org/jira/browse/ARIES-1887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16762853#comment-16762853
]
Nicolas Dutertry commented on ARIES-1887:
-----------------------------------------
The ComponentTxData object is not attached to a transaction but to a blueprint
bean (thru TxInterceptorImpl). So you can have several threads accessing the
same bean and thus the same map.
I have run into random "javax.persistence.TransactionRequiredException: no
transaction is in progress" in multi-threaded scenario and I have finally
discovered it came from this HashMap containing wrong data.
> org.apache.aries.transaction.blueprint is not thread safe
> ---------------------------------------------------------
>
> Key: ARIES-1887
> URL: https://issues.apache.org/jira/browse/ARIES-1887
> Project: Aries
> Issue Type: Bug
> Components: Transaction
> Affects Versions: transaction-blueprint-2.2.0
> Reporter: Nicolas Dutertry
> Assignee: Jean-Baptiste Onofré
> Priority: Major
> Fix For: transaction-blueprint-2.3.0
>
>
> The class ComponentTxData in org.apache.aries.transaction.blueprint uses a
> HashMap
> {code:java}
> private Map<Method, TransactionalAnnotationAttributes> txMap = new
> HashMap<Method, TransactionalAnnotationAttributes>();{code}
> This is very dangerous because txMap can be modified and accessed after
> initialization.
> It should be replaced with a ConcurrentHashMap.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)