Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jta-dev] What is the specified behavior of enlistResource when called with the same payload twice?

On Thu, Nov 10, 2022 at 11:13 AM Michael Musgrove <mmusgrov@xxxxxxxxxx> wrote:
I would say it would succeed. The XAResource API contains a method called `isSameRM` which lets us determine whether or not two XAResource instances are connected to the same Resource Manager. We use that to determine whether an enlistment should join an existing transaction branch or start a new one.

Right. I know that in Narayana, for example, there are two checks: one is an instance-based check (did the caller supply the same object reference twice or more in a row?), and then an isSameRM call.

Therefore the isSameRM call is not guaranteed to happen anywhere that I can see, i.e. if I register x1 twice no isSameRM call will happen.  I don't see anything in the specification that says it must happen.  (I personally don't even care if it does happen or not.)  My larger point is: it seems to me the language in enlistResource needs to be expanded a bit to describe how this all must work, or to make explicit what (apparently wide?) leeway implementations might have in implementing this method so that callers (Transaction users) know exactly what to expect or not.  Can I register the same instance twice with no side effects? What constitutes failure that isn't handled by throwing an exception? and so on.

I have the same sort of question around Transaction#registerSynchronization, BTW.


Back to the top