Search in sources :

Example 1 with JtaTransactionWrapper

use of org.keycloak.transaction.JtaTransactionWrapper in project keycloak by keycloak.

the class DefaultKeycloakTransactionManager method begin.

@Override
public void begin() {
    if (active) {
        throw new IllegalStateException("Transaction already active");
    }
    completed = false;
    if (jtaPolicy == JTAPolicy.REQUIRES_NEW) {
        JtaTransactionManagerLookup jtaLookup = session.getProvider(JtaTransactionManagerLookup.class);
        if (jtaLookup != null) {
            TransactionManager tm = jtaLookup.getTransactionManager();
            if (tm != null) {
                enlist(new JtaTransactionWrapper(session.getKeycloakSessionFactory(), tm));
            }
        }
    }
    for (KeycloakTransaction tx : transactions) {
        tx.begin();
    }
    active = true;
}
Also used : JtaTransactionManagerLookup(org.keycloak.transaction.JtaTransactionManagerLookup) KeycloakTransactionManager(org.keycloak.models.KeycloakTransactionManager) TransactionManager(javax.transaction.TransactionManager) JtaTransactionWrapper(org.keycloak.transaction.JtaTransactionWrapper) KeycloakTransaction(org.keycloak.models.KeycloakTransaction)

Aggregations

TransactionManager (javax.transaction.TransactionManager)1 KeycloakTransaction (org.keycloak.models.KeycloakTransaction)1 KeycloakTransactionManager (org.keycloak.models.KeycloakTransactionManager)1 JtaTransactionManagerLookup (org.keycloak.transaction.JtaTransactionManagerLookup)1 JtaTransactionWrapper (org.keycloak.transaction.JtaTransactionWrapper)1