io.quarkus.narayana.jta.TransactionRunnerImpl 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;
import java.util.concurrent.Callable;
import java.util.function.Function;
class TransactionRunnerImpl extends RunOptionsBase
implements TransactionRunnerOptions, TransactionRunner {
TransactionRunnerImpl(TransactionSemantics semantics) {
setSemantics(semantics);
}
@Override
public TransactionRunnerImpl timeout(int seconds) {
setTimeout(seconds);
return this;
}
@Override
public TransactionRunnerImpl exceptionHandler(Function handler) {
setExceptionHandler(handler);
return this;
}
@Override
public void run(Runnable task) {
QuarkusTransactionImpl.call(this, () -> {
task.run();
return null;
});
}
@Override
public T call(Callable task) {
return QuarkusTransactionImpl.call(this, task);
}
}