Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails Transaction in Quartz Job

Good afternoon guys.

I have a question about the transactions until the spring and Grails own when I have multiple jobs running the same service.

I have a service with a default configuration in Grails and a method that runs every 5 sec. by the quartz job, but the execution of the method takes longer than 5 sec. to be completed. My question is when will the quartz calling this method they are executed in the same transaction or a new one is created each time this happens? I know that each invocation of quartz creates a new thread, but do not know if they are within the same transaction and for example if a call it will give an exception to rollback everything that has been done so far.

I appreciate the answers.

like image 904
Carleto Avatar asked Nov 01 '22 02:11

Carleto


1 Answers

Transaction state is stored in ThreadLocals, so two concurrent transactional service calls on different threads would each have their own transactions.

like image 188
Burt Beckwith Avatar answered Nov 09 '22 09:11

Burt Beckwith