[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
Fri Mar 15 16:07:13 EDT 2013


[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.

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


More information about the jboss-as7-dev mailing list