struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale Newfield <D...@Newfield.org>
Subject Re: [struts] [Struts2]ExecAndWaitInterceptor and BackgroundProcess issue
Date Sat, 06 Sep 2008 17:26:03 GMT
Ramanathan RV wrote:
> I seem to have hit an issue with using ExecAndWaitInterceptor because of the
> way it is designed. The background process is invoked in this fashion:
> 
> *                public void run() {
>                     try {
>                         beforeInvocation();
>                         result = invocation.invokeActionOnly();
>                         afterInvocation();
>                     } catch (Exception e) {
>                         exception = e;
>                     }
> 
>                     done = true;
>                 }
> 
> *I am using afterInvocation to cleanup certain thread local managed
> resources that were used by the action. What this means is that if there is
> any exception in the course of action invocation, then I have no way to
> clean up the resources.
> 
> I am sorry but I am left with no other option except to blame the design. It
> was preposterous to have the thread invocation in the constructor. I have
> absolutely no way to redefine the behaviour now. Please do refactor this
> code so that it is really usable. Should I file a bug for the same?

It sounds like this should be:

try {
   beforeInvocation();
   result = invocation.invokeActionOnly();
} catch (Exception e) {
   exception = e;
} finally {
   afterInvocation();
   done = true;
}

Can you test this variation and if it works for you (and doesn't break 
any of the test cases) submit a ticket/patch with it?

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message