[hibernate-dev] new proposal for tx timeout handling using transaction DISASSOCIATING event notification...
steve at hibernate.org
Tue Mar 10 11:44:59 EDT 2015
Scott, I am not following. Pardon me if I am being dense :)
Today, in our afterCompletion hooks we have code that, in the case of
rollback, tries to make a determination of whether the rollback is due to a
timeout or a "normal" rollback. If we deem a timeout occurred, then we
delay the afterCompletion processing.
So how, specifically, would this be different in what you propose?
Are you saying that with this listener approach, that the listener would be
notified of disassociation prior to the afterCompletion callback on our
RegisteredSynchronization? But in the timeout case, the disassociation
would happen later?
On Mon, Mar 9, 2015 at 1:19 PM, Scott Marlow <smarlow at redhat.com> wrote:
> With a proposed TM level listener, we will have an SPI for notification
> of when application threads associated with a JTA transaction, become
> disassociated with the transaction (tm.commit/rollback/suspend time).
> Having this knowledge in a synchronization callback, can determine
> whether the persistence context should be cleared directly from the
> Synchronization.afterCompletion(int) call or should be deferred until
> the transaction is disassociated from the JTA transaction.
> This idea is based on a TM level listener approach that Tom Jenkinson
>  suggested. Mike Musgrove has a "proof of concept" implementation of
> the suggested changes . I did some testing with  to see if the
> improvement helps with clearing entities that might still be in the
> persistence context after a background tx timeout.
> I'm wondering if in the Hibernate ORM
> Synchronization.afterCompletion(int status) implementation, in case of
> tx rollback, if we could defer the clearing of the Hibernate session to
> be handled by the JtaPlatform. This could be setup at
> EntityManager.joinTransaction() time (if a new property like
> "hibernate.transaction.defer_clear_session" is true). Perhaps via a
> JtaPlatform.joinTransaction(EntityManager) registration call?
>  https://developer.jboss.org/thread/252572?start=45&tstart=0
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
More information about the hibernate-dev