REPEATABLE_READ 的 spring 事务注释超时

Timeout in spring transaction anootation for REPEATABLE_READ

如果我在 @Transactional 上应用超时,它会在超时后解锁行还是会抛出异常?

@Transactional(isolation=Isolation.REPEATABLE_READ, timeout=100)
public ExternalServerListenerInfo getTokenForLiveScoutListener() {}

经过一番研究,我找到了以下答案:

Timeout specifies the maximum time allowed for a transaction to run. This may be required since transactions that run for a very long time may unnecessarily hold locks for a long time. When a transaction reaches the timeout period, it is rolled back. Timeout needs to be specified only on propagation settings that start a new transaction (from http://www.studytrails.com/frameworks/spring/spring-transaction-attributes.jsp)

所以,从细节来看,它似乎会回滚事务并释放数据库的锁。