Skip to main content

TransactionManager getId and getContext

· One min read
Alejandro Revilla

TransactionParticipants get called by the TransactionManager using their prepare, prepareForAbort, commit and abort callbacks, but for situations where one needs access to the Context in a deeper class, called by the participant (i.e. Managers), we now have a couple of static ThreadLocal based methods:

  • Serializable getSerializable()
  • Context getContext() (in case your Serializable is actually an instance of org.jpos.transaction.Context)
  • Long getId ()

Please note returned values may be null when run outside the TM life-cycle.

Also note that the TM takes care of PAUSED transactions, setting these values on the resumed thread.

See ChangeLog - 6da5f3 for details.