use of org.wildfly.transaction.client.AssociationListener in project wildfly by wildfly.
the class TransactionManagerService method start.
public void start(final StartContext context) throws StartException {
final UserTransactionRegistry registry = registryInjector.getValue();
LocalTransactionContext.getCurrent().registerCreationListener((txn, createdBy) -> {
if (createdBy == CreationListener.CreatedBy.USER_TRANSACTION) {
if (WildFlySecurityManager.isChecking()) {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
txn.registerAssociationListener(new AssociationListener() {
private final AtomicBoolean first = new AtomicBoolean();
public void associationChanged(final AbstractTransaction t, final boolean a) {
if (a && first.compareAndSet(false, true))
registry.userTransactionStarted();
}
});
return null;
});
} else {
txn.registerAssociationListener(new AssociationListener() {
private final AtomicBoolean first = new AtomicBoolean();
public void associationChanged(final AbstractTransaction t, final boolean a) {
if (a && first.compareAndSet(false, true))
registry.userTransactionStarted();
}
});
}
}
});
}
Aggregations