Topics

Proposed enhancement to the JTA API


 

Just wondering if there has been any movement on this issue yet.

Thanks!

On Thu, Dec 7, 2017 at 8:06 AM, David Lloyd <david.lloyd@redhat.com> wrote:
In order to support various frameworks, we have often needed the
ability to register a callback onto a Transaction in order to allow
these frameworks to track when a transaction is associated to or
dissociated from a thread. We accomplish this today using internal
APIs. After some internal discussions it was decided that this should
be brought to the spec group for discussion.

I would like to request that the JTA API be enhanced to provide a
simple thread association callback, like this:

/**
* A transaction-to-thread association listener.
*/
public interface AssociationListener {
/**
* Inform the listener that a transaction's thread association has changed.
*
* @param transaction the transaction whose association has
changed (not {@code null})
* @param associated {@code true} if the association was created,
or {@code false}
* if the association was removed
*/
void associationChanged(Transaction transaction, boolean associated);
}

The association callback is called with a value of 'true' as the last
action of a transaction resume or begin, and with a value of 'false'
as the first action of a transaction suspend, or of a commit or
rollback that happens by way of the TransactionManager interface.

Here are a few ideas for the registration portion of the API.

Option 1: Enhance javax.transaction.Transaction

public interface Transaction {
// [...]

/**
* Register a transaction association listener.
*
* @param listener the listener to register (must not be {@code null})
*/
void registerAssociationListener(AssociationListener listener);
}

Option 2/3: Enhance
javax.transaction.TransactionSynchronizationRegistry or
javax.transaction.TransactionManager

For example:

public interface TransactionSynchronizationRegistry {
// [...]

/**
* Register a transaction association listener on to a transaction.
*
* @param transaction the transaction to register to (must not be
{@code null})
* @param listener the listener to register (must not be {@code null})
*/
void registerAssociationListener(Transaction transaction,
AssociationListener listener);
}

Any thoughts on the feasibility of this enhancement for JTA 1.3?
--
- DML
--
- DML


 
Edited

JTA 1.3 is completed so it can't go there.  Release 1.3 is used to remove the three javax.transaction.xa.* classes that duplicate the classes owned by Java SE.  Note that the javax.transaction.* classes have been removed from Java SE 11 so there is no longer an overlap between Java SE and Java EE for the transaction API classes. See https://jcp.org/aboutJava/communityprocess/mrel/jsr907/index3.html for downloads.

Also note that the Java Transaction API project has been moved to the Eclipse Enterprise for Java (EE4J) project so the processing going forward will need to change.

I realize this isn't getting to the heart of your request but just clarifying what is happening with respect to releases of the API jar file.