Search code examples
javaignitegridgain

Does not calling org.apache.ignite.transactions.Transaction#close after a #commit or #rollback cause leaks/problems?


I recently noticed while debugging some issues that a poorly written piece of code DOES NOT call org.apache.ignite.transactions.Transaction#close after calling org.apache.ignite.transactions.Transaction#rollback. It was neither using try-with-resources nor doing it in a finally.

I am aware and see it mentioned in the docs as-well that Ignite Transaction object needs to be closed after use.

My question is what is the impact of this. Would it result in leaks or other issues?

Thanks


Solution

  • From glancing in the code, it should not be a problem. close() waits on a future (which should already happen when doing rollback()) and then returns if transaction is COMMITTED or ROLLED_BACK. Not missing anything important.