Nee*_*att 4 grails spring spring-webflow
每当我在web-flow中将一个状态切换到另一个状态超过15次时,我就会遇到异常.
No flow execution snapshot could be found with id '1'; perhaps the snapshot has been removed? . Stacktrace follows:
org.springframework.webflow.execution.repository.FlowExecutionRestorationFailureException: A problem occurred restoring the flow execution with key 'e7s1'
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.webflow.execution.repository.snapshot.SnapshotNotFoundException: No flow execution snapshot could be found with id '1'; perhaps the snapshot has been removed?
... 3 more
Run Code Online (Sandbox Code Playgroud)
我正在使用grails webflow插件.
有谁知道为什么会发生这种情况以及如何解决这个问题?
Web Flow一次仅在其存储库中保留指定数量的Executions("e7")和Snapshots("s1").这对于限制可以消耗多少内存很有用.我猜测默认值是15,在这种情况下,当你从一个状态移动到状态时,执行"e7"可以有15个快照.一旦你点击"e7s16","s1"将被丢弃,从而为你提供你看到的结果.
您可以使用配置元素更改默认值<webflow:flow-execution-repository>:
<!-- Executes flows: the entry point into the Spring Web Flow system -->
<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
<webflow:flow-execution-repository max-execution-snapshots="20" max-executions="2"/>
</webflow:flow-executor>
Run Code Online (Sandbox Code Playgroud)
引用上面的链接:
调整max-execution-snapshots属性以限制每个流执行可以获取的历史快照数.要禁用快照,请将此值设置为0.要启用无限数量的快照,请将此值设置为-1.
但是,我确实发现默认行为是不可接受的,当您碰巧访问过期的快照时,您只会得到一个例外.最近的另一个问题是关于如何捕捉到这种情况,大概是这样你可以在它发生时做一些更有用的事情.
(我们实现了自定义代码,以便在HttpSession中携带最后一个有效的快照,以便我们可以在发生异常时将用户发送到那里.)
感谢您的帮助。但我正在使用 grails 应用程序。我已经使用以下代码修复了它。
DefaultFlowExecutionRepository defaultFlowExecutionRepository=(DefaultFlowExecutionRepository)Holders.applicationContext.getBean('flowExecutionRepository');
defaultFlowExecutionRepository.setMaxSnapshots(100)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6150 次 |
| 最近记录: |