Interface JtaTransactionLookup

All Known Implementing Classes:
Jta, JtaLookupService

public interface JtaTransactionLookup
A read-only view of the JTA transaction bound to a request, with only JDK types in its signatures.

This is the integration point for modules such as a JPA adapter that need to know whether the current request has an active JTA transaction. Such a module does not need a compile dependency on axiom-jta: it can load this interface by name from ServiceLoader and call its three methods reflectively, because the arguments and results are Object, String and boolean. The implementation shipped by axiom-jta is registered as a service and consults every Jta instance built in this class loader, keyed by the request's context object. It never starts, completes or mutates a transaction.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    active(Object context)
    Reports whether a transaction is currently associated with the request represented by context.
    boolean
    Reports whether the request's active transaction has been marked rollback-only.
    status(Object context)
    Returns the request's transaction status as a plain name: ACTIVE, MARKED_ROLLBACK, COMMITTED, ROLLED_BACK, INACTIVE or UNKNOWN.
  • Method Details

    • active

      boolean active(Object context)
      Reports whether a transaction is currently associated with the request represented by context.
      Parameters:
      context - the request's Axiom context, or any object to answer false
      Returns:
      true while a transaction is active for that request
    • status

      String status(Object context)
      Returns the request's transaction status as a plain name: ACTIVE, MARKED_ROLLBACK, COMMITTED, ROLLED_BACK, INACTIVE or UNKNOWN.
      Parameters:
      context - the request's Axiom context
      Returns:
      one of the six status names
    • rollbackOnly

      boolean rollbackOnly(Object context)
      Reports whether the request's active transaction has been marked rollback-only.
      Parameters:
      context - the request's Axiom context
      Returns:
      true when rollback-only was set by the handler or the provider