commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samad Haytham <>
Subject [chain] When does a filter run?
Date Fri, 06 May 2005 16:51:18 GMT
Question about how filters work as we are seeing behaviour that is a
little different from what we expected.  We setup a filter as the
second command in a 4 command chain.  Following is an example config

<chain name="myChain">
  <command id="1"....
  <command id="myfilter"..... />
  <command id="3".../>
  <command id="4" ...../>

If command 1 throws an Exception, myfilter's postprocess is never
called.  Looking at the code, we realized that the filters are
executed in reverse order from where an exception is thrown (or the
chain ends).  Meaning that the filter's postprocess method is only
called if the execute method is called.  What we wanted was a way to
have one filter's postprocess method handle any exceptions that are
thrown.  To enable that with how Chains currently works, we move our
filter to the beginning of the chain.  Are there any other ways to do
this?  Define a Filter (no matter where in the Chain - in our case it
was the last command called JobEnd) and guarantee that its postprocess
is called?

BTW, its been nice working with chains.  Any information as to what we
can expect in the next release?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message