io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequiresNew Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-narayana-jta Show documentation
Show all versions of quarkus-narayana-jta Show documentation
Offer JTA transaction support (included in Hibernate ORM)
package io.quarkus.narayana.jta.runtime.interceptor;
import javax.annotation.Priority;
import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.Transactional;
/**
* @author [email protected] 25/05/2013
*/
@Interceptor
@Transactional(Transactional.TxType.REQUIRES_NEW)
@Priority(Interceptor.Priority.PLATFORM_BEFORE + 200)
public class TransactionalInterceptorRequiresNew extends TransactionalInterceptorBase {
public TransactionalInterceptorRequiresNew() {
super(false);
}
@Override
@AroundInvoke
public Object intercept(InvocationContext ic) throws Exception {
return super.intercept(ic);
}
@Override
protected Object doIntercept(TransactionManager tm, Transaction tx, InvocationContext ic) throws Exception {
if (tx != null) {
tm.suspend();
return invokeInOurTx(ic, tm, () -> tm.resume(tx));
} else {
return invokeInOurTx(ic, tm);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy