[wildfly-dev] discussion about JSR352 Batch and JPA

Scott Marlow smarlow at redhat.com
Wed Sep 18 10:43:54 EDT 2013


On 09/18/2013 08:54 AM, Scott Marlow wrote:
> What are the requirements for supporting Batch section 11.6 [1]?  From
> looking at JSR352, I get that each "chunk" has its own JTA transaction.
>    I previously had heard that we only supported starting the transaction
> from the application processing code (via UserTransaction) but I think
> the Batch container/runtime should start a JTA transaction for each
> "chunk" that is processed.  What are we really doing for managing the
> JTA transactions for batch?

 From IRC discussion, 
https://github.com/jberet/jsr352/blob/master/jberet-core/src/main/java/org/jberet/runtime/runner/ChunkRunner.java 
shows how we using the start/end the Transaction via UT, at the chunk level.

I'll work on a unit test that includes JPA in chunk processing.

>
>
> REGULAR CHUNK PROCESSING & JPA
>
>
> For the JPA support for regular chunk processing [1], the following will
> give a new underlying persistence context per chunk (jta tx):
>
> @PersistenceContext(unitName = "chunkNonpartitionedAZTT4443334")
>    EntityManager em;
>
>
> PARTITIONED CHUNK PROCESSING & JPA
>
>
> For the JPA support for partitioned chunk processing [2], the following
> will give a new underlying persistence context per chunk (jta tx):
>
> @PersistenceContext(unitName = "chunkpartitionedAZTT4443334")
>    EntityManager em;
>
> One concern that I have about partitioning is the performance impact of
> deadlocking and waiting for the JTA transaction to time out.  Depending
> on whether the work is configured to retry or not, hitting several dead
> locks in a batch process could defeat some of the performance gains of
> partitioning.  Avoiding deadlocks by always reading/writing/locking the
> underlying database resources in the same exact order, would help avoid
> deadlocks.
>
> Beyond the basic JPA capability of ensuring that each "chunk", has its
> own persistence context, how else can we help the batch processing
> experts writing JSR-352 applications on WildFly/Hibernate?
>
> Anything else to discuss about JPA & Batch?
>
> [1] Batch spec section section 11.6 Regular Chunk Processing
> https://gist.github.com/scottmarlow/6603746
>
> [2] Batch spec section Batch 11.7 Partitioned Chunk Processing
> https://gist.github.com/scottmarlow/6607667
>
> [3] persistence.xml https://gist.github.com/scottmarlow/6608533
>
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>



More information about the wildfly-dev mailing list