[jboss-as7-dev] JTA Synchronization.afterCompletion callback can occur in a background thread but JPA EntityManager must be accessed in single-threaded manner...

Scott Marlow smarlow at redhat.com
Tue Mar 19 16:03:59 EDT 2013


https://github.com/jbossas/jboss-as/pull/4256 is the first 
implementation of the container side fix for AS7-6586.

When JBTM-1556 is fixed, we can switch to using that instead of 
referencing the "TX reaper thread" by its current name.  If the reaper 
thread name changes, our unit test will fail as an indication.

I was pleased to see that the "@TransactionTimeout(value = 1, unit = 
TimeUnit.SECONDS)" resulted in a short timeout for this test. :)

On 03/18/2013 11:20 AM, Scott Marlow wrote:
> On 03/15/2013 04:07 PM, Scott Marlow wrote:
>> [1] contains the updated JPA 2.1 specification requirements for when the
>> JTA transaction times out from a background thread.
>>
>> AS7-6586 [2] will address the [1] requirements for AS8 and will be a
>> candidate for back-porting as needed.  For the container side, knowing
>> if we are in the "Transaction Reaper Worker N" thread would be helpful
>> (by checking thread name or via a JBossTM spi).  I don't like the idea
>> of checking the thread name but also don't have the
>> (isCurrentThreadTheReaper()) spi in hand currently.
>
> I created JBTM-1556 for adding a JBossTM/JBossTS way to know if the
> current thread is the reaper.
>
>
>>
>> The Hibernate team already has committed the provider side fix [3].
>>
>> [1]
>> http://java.net/projects/jpa-spec/lists/jsr338-experts/archive/2013-03/message/38
>>
>> [2] AS7-6586 - "JPA afterCompletion sync may be called from
>> non-application thread, resolve concurrency concern"
>>
>> [3] HHH-7910 - "Transaction timeout can cause non-threadsafe session
>> access by reaper thread"
>>
>> Scott
>> _______________________________________________
>> jboss-as7-dev mailing list
>> jboss-as7-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>
>
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>



More information about the jboss-as7-dev mailing list