You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ramanathan RV <ra...@gmail.com> on 2008/08/21 10:19:23 UTC
[Struts2]ExecAndWaitInterceptor and BackgroundProcess issue
Hello,
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?
--
Thanks
Ram
Re: [struts] [Struts2]ExecAndWaitInterceptor and BackgroundProcess
issue
Posted by Dale Newfield <Da...@Newfield.org>.
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