I have an JEE application which runs on a JBOSS EAP 7. There is a long running asynchronous method which does import data into another system. After beeing triggered it runs into transactions problems after 5 minutes which is the JBOSS default transaction timeout. So far so good. I changed the behaviour (pseudo code):
Before:
@Transactional(Required) //which is default
//The whole process takes usually longer than 5 min
void doImport{
for(n-number of datsets){
importOneDataSet();
}
}
After:
@Transactional
void doImport{
for(n-number of datsets){
importOneDataSet();
}
}
...
@Transactional(Requires_New)
//a new transaction is created and the "outer" is suspended
//to import one dataset is below 5min
void importOneDataSet(){
...
}
I assumed that the outer transaction timeout is stopped when it is paused/suspended but I still run into a transaction timout error after 5 minutes.
So it seems that suspending transactions does not influence its transaction timeout? Is that app server specific our is it defined in the JEE standard? And the third question would be: How would you solve this problem? Don't open the outer transaction? Increase the timeout (only) for that transaction?
It is puzzling that most transaction articles I read doesn't even mention that fact. The only hint regarding that topic was one blog post.