Skip to content

YOJ 2.7.4 (StdTxManager fixes and improvements)

Choose a tag to compare

@nvamelichev nvamelichev released this 18 Dec 22:52
· 25 commits to main since this release

Bugfixes and improvements

  • StdTxManager's log transaction ID (tx-id in MDC) was not always unique. tx-* MDC keys were nonexistent when logging out of Tx.defer() and Tx.finally() callbacks
    • Properly increment "log transaction ID" (tx-id in MDC) on transaction run, and not on StdTxManager construction.
      Versions of YOJ prior to 2.6.40 got away with it because a fresh StdTxManager instance was force-created by StdTxManager.tx() (for tx name auto-generation), or StdTxManager.withName() and/or StdTxManager.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's MDCCloseable, which uses Java's try-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.