YOJ 2.7.4 (StdTxManager fixes and improvements)
Bugfixes and improvements
StdTxManager's log transaction ID (tx-id in MDC) was not always unique.tx-*MDC keys were nonexistent when logging out ofTx.defer()andTx.finally()callbacks- Properly increment "log transaction ID" (
tx-idin MDC) on transaction run, and not onStdTxManagerconstruction.
Versions of YOJ prior to 2.6.40 got away with it because a freshStdTxManagerinstance was force-created byStdTxManager.tx()(for tx name auto-generation), orStdTxManager.withName()and/orStdTxManager.withLogContext()was explicitly called by the user, incrementing the counter. - Do not remove
tx-*MDC keys before the transaction exception is logged.
Previous versions of YOJ relied upon slf4j'sMDCCloseable, which uses Java'stry-with-resources. This meant that MDCCloseable.close()was called beforecatchandfinallyblocks were entered, and the MDC was already cleared of thetx-*` MDC keys. Now we use our own MDC management mechanism (similar to the one proposed for slf4j 2.1.x), and the MDC is cleared at the right time.
- Properly increment "log transaction ID" (