Skip to content

Commit

Permalink
Avoid contention on lookup of UserTransaction and TransactionManager
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanne committed Sep 27, 2019
1 parent 9b52fcf commit 89abf61
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
@Dependent
public class NarayanaJtaProducers {

private static final javax.transaction.UserTransaction USER_TRANSACTION = UserTransaction.userTransaction();
private static final javax.transaction.TransactionManager TRANSACTION_MANAGER = TransactionManager.transactionManager();

@Produces
@ApplicationScoped
public UserTransactionRegistry userTransactionRegistry() {
Expand All @@ -27,14 +30,13 @@ public UserTransactionRegistry userTransactionRegistry() {
@Produces
@ApplicationScoped
public javax.transaction.UserTransaction userTransaction() {
return UserTransaction.userTransaction();
return USER_TRANSACTION;
}

@Produces
@ApplicationScoped
public XAResourceRecoveryRegistry xaResourceRecoveryRegistry() {
return new RecoveryManagerService();

}

@Produces
Expand All @@ -46,7 +48,7 @@ public TransactionSynchronizationRegistry transactionSynchronizationRegistry() {
@Produces
@ApplicationScoped
public javax.transaction.TransactionManager transactionManager() {
return TransactionManager.transactionManager();
return TRANSACTION_MANAGER;
}

@Produces
Expand Down

0 comments on commit 89abf61

Please sign in to comment.