同様の問題がありました。フォームの送信によって終了アクションが呼び出された場合、会話が既に閉じられているか期限切れであるというエラーが常に発生していました。
もちろん、会話を終了しなければ、メモリ リソースは解放されません。これに関する情報は、strut2 会話プラグイン サイト ( https://code.google.com/p/struts2-conversation/wiki/UsageGuide#Memory_Management ) で入手できます。
そこでは、会話スレッドの有効期限と同時に使用できるそれらの数に関連するいくつかのパラメーターを設定できることがわかります。
<!-- monitoring frequency in milliseconds -->
<constant name="conversation.monitoring.frequency" value="300000"/>
<!-- idle conversation timeout in milliseconds -->
<constant name="conversation.idle.timeout" value="28800000"/>
<!-- max instances of a conversation -->
<constant name="conversation.max.instances" value="20"/>
<!-- number of timeout monitoring threads -->
<constant name="conversation.monitoring.thread.pool.size" value="20"/>
とにかく、 @EndConversation タグを含むアクションを呼び出す最後のアクションにリダイレクト結果を追加して、この問題を解決しました。その中で、最後にしたい結果を設定しました。会話フィールド変数は引き続き正しく設定され、使用可能です。
@ConversationAction(conversations = "form")
@Action(value="formSecondLast", results={@Result(name=SUCCESS, type = "redirect", location="formLast")})
public String formSecondLast() throws Exception {
//Here goes the code you want it to manipulate the conversation field data.
//Maybe save to the database or send it to the business tier.
return SUCCESS;
}
@EndConversation(conversations = "form")
@Action(value="formLast", results={@Result(name=SUCCESS, location="/jsp/form-end.jsp")})
public String formEnd() throws Exception {
// This is a dummy action that does not do anything.
// It is called just after formSecondLast ends and sends the user the jsp page.
return SUCCESS;
}