[infinispan-dev] discussion about impact of using TransactionSynchronizationRegistry in AS7...

Sanne Grinovero sanne.grinovero at gmail.com
Thu Jun 2 09:25:16 EDT 2011


Both Infinispan Query and Hibernate Search register transaction
synchronizations:

org.infinispan.query.backend.TransactionalEventTransactionContext.registerSynchronization(Synchronization)
org.hibernate.search.backend.impl.EventSourceTransactionContext.registerSynchronization(Synchronization)

but neither uses the TransactionSynchronizationRegistry, at least
directly. Search delegates the registration to Hibernate core in most
cases (but does not with local transactions).

https://github.com/hibernate/hibernate-search/blob/master/hibernate-search/src/main/java/org/hibernate/search/backend/impl/EventSourceTransactionContext.java#L104

Infinispan Query always registers directly on the tx:
https://github.com/infinispan/infinispan/blob/master/query/src/main/java/org/infinispan/query/backend/TransactionalEventTransactionContext.java#L118

Sanne

2011/6/2 Scott Marlow <smarlow at redhat.com>:
> On 06/02/2011 05:31 AM, Mircea Markus wrote:
>>
>> On 1 Jun 2011, at 20:49, Scott Marlow wrote:
>>
>>> I posted a message on the as7-dev ml
>>> (http://lists.jboss.org/pipermail/jboss-as7-dev/2011-May/002254.html),
>>> about switching to use the TransactionSynchronizationRegistry.
>>>
>>> Does Infinispan currently register Transaction synchronization objects?
>> yes
>>>   Does Infinispan currently register synchronizations via
>>> TransactionSynchronizationRegistry (TSR)?
>> no, we register synchronizations through transaction.registerSynchronization
>>>
>>> I'm trying to get a sense for, what would happen if container managed
>>> (AS7) session beans were registered with the active JTA transaction via
>>> the TSR.
>>>
>>> If AS7 switches to use the TSR, I think that Infinispan might need to
>>> ensure that it doesn't attempt to register with the TX too late.
>> right. One way to go  is by making the registration code pluggable.
>
> I should point out that I believe its only a problem, to call
> Transaction.registerSynchronization() after the point, where the
> ordering cannot be correct.  However, no such checking is performed if
> no components are registering their syncs via
> TransactionSynchronizationRegistry.
>
> So, another question, how likely would it be, that an application would
> see Infinispan registering a sync via
> Transaction.registerSynchronization(), after the transaction commit has
> been initiated?
>
> If Transaction.registerSynchronization() will always be called by
> Infinispan before the transaction commits.  We shouldn't have to be as
> concerned about support for registering the Infinispan syncs with
> TransactionSynchronizationRegistry.
>
> If the answer is we aren't sure or Transaction.registerSynchronization()
> could happen after the transaction commit has been started, we should
> have it be pluggable.
>
>>>
>>> See http://pastie.org/1836698 for an example of what would happen if a
>>> TSR synchronization object is already present and someone tries to
>>> register a TX synchronization after tx.commit has been started.
>> hmm, this stack trace shows an exception being thrown by the Synchrnoization.beforeCompletion object.
>> Doesn't look like the TransactionManager throws the exception not allowing the sync to be registered.
>>>
>>>
>>> _______________________________________________
>>> infinispan-dev mailing list
>>> infinispan-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>
>>
>> _______________________________________________
>> infinispan-dev mailing list
>> infinispan-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>



More information about the infinispan-dev mailing list