I am wondering how @TranscationTimeout is handled by WildFly, especially when invoking anothers EJB method annotated with @TransactionAttribute but not with @TransactionTimeout itself.
I have searched WildFly documentation, API Docs and of course googled, but I am not able to find any statements.
Consider the following scenario. We have stateless EJBs A and B.
@Stateless
public class A {
@Inject
private B b;
@TransactionTimeout(unit = TimeUnit.MINUTES, value = 10)
public void t() {
b.t();
}
}
@Stateless
public class B {
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void t() {
}
}
When invoked by client, I expect:
What happens:
It seems that @TransactionTimeout is inherited to nested EJB methods if they are not annotated with @TransactionTimeout in some way respectively container default is overriden when they are called. Is this behavior wanted? Are there exceptions?
I am running WildFly 10.1.0 with Java 8.
As TransactionTimeout-Annotation states:
"Annotation for specifying the transaction timeout of a newly started transaction when invoking an EJB business method"
That means imO: for a newly started transaction, not for the currently running transaction. Therefore B:t is affected since it starts a new transaction, as possibly is A:t, but only if it is called out of a non transactional context. (default @Requires might mean, that the transaction is already running.)
This would then fit to your observations.