英文:
Why are Spring retry's stateful retries necessary with transactional resources?
问题
在Spring retry的README中,他们提到了如何通过使用一个Map来实现“有状态的重试”,以实现回滚事务,而“无状态的重试”不足以做到这一点。
我不太理解他们的意思。
如果我想要一个事务方法来回滚事务并重试一个新的事务,那么有状态的重试和无状态的重试有什么不同呢?
英文:
In Spring retry's README, they mention how a "stateless retry" is not enough to rollback a transaction, but a stateful retry can by using a Map ?
I don't really understand what they mean.
If I want a transactional method to rollback the transaction and retry with a new one, how is a stateful retry different than a stateless retry ?
答案1
得分: 1
为了使事务回滚,异常必须传播到调用者(假设事务在可重试方法的上游某处启动)。
对于无状态的情况,重试是在单个事务范围内执行的。
英文:
In order for the transaction to roll back, the exception must be propagated to the caller (assuming the transaction is started somewhere upstream of the retryable method).
With stateless, the retries are performed within the scope of a single transaction.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论