<div dir="ltr"><div class="gmail_default" style=""><font face="trebuchet ms, sans-serif">Sorry, </font>ContextTransactionSynchronizationRegistry is not usable in the way WFLY-11166 contemplated. LocalTransactionContextService wires the <span style="color:rgb(0,0,0)">org.jboss.as.txn.service.inter</span><span style="color:rgb(0,0,0)">nal.tsr.TransactionSynchroniza</span><span style="color:rgb(0,0,0)">tionRegistryWrapper into the builder object that's meant to drive the org.wildfly.transaction.client stuff but it turns out that object is just discarded, and ContextTransactionSynchronizationRegistry doesn't use it.</span></div><div class="gmail_default" style=""><span style="color:rgb(0,0,0)"><br></span></div><div class="gmail_default" style=""><span style="color:rgb(0,0,0)">I'll work up a revert commit.</span></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 15, 2018 at 11:10 AM Brian Stansberry <<a href="mailto:brian.stansberry@redhat.com">brian.stansberry@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">I suspect this is a bug I introduced in WFLY-11166, which was not meant to change any behavior but perhaps did. I'm having a look.</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 15, 2018 at 10:02 AM Scott Marlow <<a href="mailto:smarlow@redhat.com" target="_blank">smarlow@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On 11/15/18 5:39 AM, Tom Jenkinson wrote:<br>
> <br>
> <br>
> On 15 November 2018 at 09:41, Stefano Maestri <<a href="mailto:smaestri@redhat.com" target="_blank">smaestri@redhat.com</a> <br>
> <mailto:<a href="mailto:smaestri@redhat.com" target="_blank">smaestri@redhat.com</a>>> wrote:<br>
> <br>
> <br>
> <br>
> On Wed, Nov 14, 2018 at 10:55 PM Tom Jenkinson<br>
> <<a href="mailto:tom.jenkinson@redhat.com" target="_blank">tom.jenkinson@redhat.com</a> <mailto:<a href="mailto:tom.jenkinson@redhat.com" target="_blank">tom.jenkinson@redhat.com</a>>> wrote:<br>
> <br>
> The JCAOrderedLastSynchronizationList is intended to guarnatee<br>
> the ordering in the JVM so it seems very likely it should be used.<br>
> <br>
> <br>
> +1<br>
> <br>
> I wonder why the wrapper is not being injected into JPA and JCA?<br>
> <br>
> <br>
> I don't see any reason in fact. And I don't remember any issues or<br>
> discussion specific to this.<br>
> <br>
> <br>
> Hi Scott, I suggest to open a WFLY issue with the details and any <br>
> reproducer you can provide - thanks!<br>
<br>
<a href="https://issues.jboss.org/browse/WFLY-11360" rel="noreferrer" target="_blank">https://issues.jboss.org/browse/WFLY-11360</a> asks the question:<br>
<br>
"<br>
Apparently we are doing a JNDI lookup of <br>
"java:jboss/TransactionSynchronizationRegistry" for Hibernate ORM <br>
integration, which means we are using the <br>
org.jboss.as.txn.service.internal.tsr.TransactionSynchronizationRegistryWrapper <br>
for Hibernate ORM. Should we also be using the <br>
org.jboss.as.txn.service.internal.tsr.TransactionSynchronizationRegistryWrapper <br>
class in other WildFly call sites, instead of <br>
org.wildfly.transaction.client.ContextTransactionSynchronizationRegistry?<br>
"<br>
<br>
Responses in the jira are welcome :)<br>
<br>
Scott<br>
<br>
> <br>
> <br>
> Best,<br>
> S.<br>
> <br>
> <br>
> <br>
> On 14 November 2018 at 17:34, Scott Marlow <<a href="mailto:smarlow@redhat.com" target="_blank">smarlow@redhat.com</a><br>
> <mailto:<a href="mailto:smarlow@redhat.com" target="_blank">smarlow@redhat.com</a>>> wrote:<br>
> <br>
> Hi,<br>
> <br>
> I made a local change to JCAOrderedLastSynchronizationList,<br>
> to have the<br>
> JPA container (TransactionUtil$SessionSynchronization)<br>
> afterCompletion()<br>
> always be run after Hibernate afterCompletion() but before<br>
> the JCA<br>
> afterCompletion(). As I am implementing EntityManager<br>
> caching [1] and<br>
> want to ensure that the EntityManager instances are only<br>
> returned to the<br>
> cache after the EntityManager is expected to be available<br>
> for reuse.<br>
> <br>
> In my debugging, I noticed that the<br>
> JCAOrderedLastSynchronizationList<br>
> only has the Hibernate synchronizations being added but not<br>
> the JCA or<br>
> JPA container synchronizations. [2] shows that the JCA + JPA<br>
> Synchronizations are registered via<br>
> org.wildfly.transaction.client.ContextTransactionSynchronizationRegistry<br>
> <br>
> and Hibernate ORM Synchronization is registered via the<br>
> org.jboss.as.txn.service.internal.tsr.TransactionSynchronizationRegistryWrapper<br>
> <br>
> Should<br>
> org.wildfly.transaction.client.ContextTransactionSynchronizationRegistry<br>
> <br>
> be changed to use JCAOrderedLastSynchronizationList as well,<br>
> so that<br>
> IronJacamar (JCA) Synchronizations are run in the correct order?<br>
> <br>
> Should we change the JPA subsystem/container to also ensure<br>
> that<br>
> Hibernate ORM 5.3 uses the<br>
> ContextTransactionSynchronizationRegistry<br>
> instead of the<br>
> org.jboss.as.txn.service.internal.tsr.TransactionSynchronizationRegistryWrapper?<br>
> <br>
> <br>
> <br>
> Is there a WildFly service that represents the<br>
> org.wildfly.transaction.client.ContextTransactionSynchronizationRegistry<br>
> <br>
> lifecycle? The JPA persistence unit service (or global JPA<br>
> service)<br>
> should depend on that service, so that applications undeploy<br>
> if the TSR<br>
> is stopped.<br>
> <br>
> [3] is also related to the the [1] effort and would be<br>
> impacted by the<br>
> above mentioned changes.<br>
> <br>
> Scott<br>
> <br>
> [1] EntityManager caching<br>
> <a href="https://issues.jboss.org/browse/WFLY-11233" rel="noreferrer" target="_blank">https://issues.jboss.org/browse/WFLY-11233</a><br>
> <<a href="https://issues.jboss.org/browse/WFLY-11233" rel="noreferrer" target="_blank">https://issues.jboss.org/browse/WFLY-11233</a>><br>
> <br>
> [2]<br>
> <a href="https://paste.fedoraproject.org/paste/-wHaYB3mzR2yTXTfU3LbZA" rel="noreferrer" target="_blank">https://paste.fedoraproject.org/paste/-wHaYB3mzR2yTXTfU3LbZA</a><br>
> <<a href="https://paste.fedoraproject.org/paste/-wHaYB3mzR2yTXTfU3LbZA" rel="noreferrer" target="_blank">https://paste.fedoraproject.org/paste/-wHaYB3mzR2yTXTfU3LbZA</a>><br>
> <br>
> [3] Ensure that Hibernate uses direct reference to TSR for<br>
> better<br>
> performance <a href="https://issues.jboss.org/browse/WFLY-11243" rel="noreferrer" target="_blank">https://issues.jboss.org/browse/WFLY-11243</a><br>
> <<a href="https://issues.jboss.org/browse/WFLY-11243" rel="noreferrer" target="_blank">https://issues.jboss.org/browse/WFLY-11243</a>><br>
> _______________________________________________<br>
> wildfly-dev mailing list<br>
> <a href="mailto:wildfly-dev@lists.jboss.org" target="_blank">wildfly-dev@lists.jboss.org</a> <mailto:<a href="mailto:wildfly-dev@lists.jboss.org" target="_blank">wildfly-dev@lists.jboss.org</a>><br>
> <a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a><br>
> <<a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a>><br>
> <br>
> <br>
> _______________________________________________<br>
> wildfly-dev mailing list<br>
> <a href="mailto:wildfly-dev@lists.jboss.org" target="_blank">wildfly-dev@lists.jboss.org</a> <mailto:<a href="mailto:wildfly-dev@lists.jboss.org" target="_blank">wildfly-dev@lists.jboss.org</a>><br>
> <a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a><br>
> <<a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a>><br>
> <br>
> <br>
_______________________________________________<br>
wildfly-dev mailing list<br>
<a href="mailto:wildfly-dev@lists.jboss.org" target="_blank">wildfly-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_-7694753467469155736gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Brian Stansberry<div>Manager, Senior Principal Software Engineer</div><div>Red Hat</div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Brian Stansberry<div>Manager, Senior Principal Software Engineer</div><div>Red Hat</div></div></div>