[jboss-user] [JBoss Seam] - Cleanup when a conversation expires

rlhr do-not-reply at jboss.com
Wed Nov 8 15:38:21 EST 2006


Hello,

I have a conversation that goes through several steps. During one step, files can be uploaded.
When the user finished the flow, the @end methods is called, and an entity is persited into the database (with the info how to retrieve the uploaded files in the file system).

Now if the user doesn't finish the flow (conversation expires), the entity will obvioulsy not be persisted. However, the uploaded files are already on the server.
My question is simple: what would be the best way to do a cleanup?

I think that it should be done by the method with the method:
@Destroy @Remove
  | public void destroy() {
  | ...
  | }
  | 
Now the thing is that this method is called whether the conversation ends properly or expires.
So one way would be to set a "ConversationConpleted" flag in the @end method.
Then in the destroy method, I'll know whether the cleanup must take place or not.

Is there any other way to do this? I mean is there any way to annotate a method that would be called in case of conversation expiration and not when the conversation ends properly (thus eliminating the need for a status flag).

Thanks

Richard



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984306#3984306

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984306



More information about the jboss-user mailing list