ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 16726] - External FilterReaders don't get chain()ed
Date Mon, 03 Feb 2003 19:53:45 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16726>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16726

External FilterReaders don't get chain()ed





------- Additional Comments From didge@foundrylogic.com  2003-02-03 19:53 -------
Magesh,

My fundamental goal is to get a one time initialization per filterreader 
element per chain.  For example, should for some silly reason, someone use the 
same filterreader twice: 
  <filterchain>
    <filterreader classname="X"/>
    <filterreader classname="X"/>
    <filterreader classname="Y"/>
  </filterchain>

X should get initialized twice, because it appears twice and Y only once.  
Thereafter, new instances would be chain()ed and never re-initalize()d.

Note that I'm not really to picky regarding how this gets accomplished.

Your earier patch (thanks!) would not work because ChainReaderHelper would have 
already instantiated and initialized the AntFilterReader's filterreader target 
on each file processed.  Calling chain() after this just creates a new 
instance, but doesn't solve the real problem: that ChainReaderHelper 
instantiates and initialize()s each AntFilterReader's target everytime when, 
IMHO, it should only get called once, just as would occur for 'out of the box' 
filterreaders.

So, regarding your final suggestion, all of my logic has always been in 
initialize(), but this makes no difference, again, because external 
filterreaders are always re-instantiated and re-initialized() every time 
getAssembledReader() is called.

Thus, my suggestion for having AntFilterReader cache filterreaders that 
implemente ChainableReaders to allow for a one time initialize() and subsequent 
calls to chain().  All it would take is an extra field in AntFilterReader and 
for ChainReaderHelper to ask AntFilterReader if it already has a 
ChainableReader instance to chain().

A snazzier way would be to have AntFilterReader implement ChainableReader.  It 
would then delegate to its ChainableReader target or instantiate and initialize 
non-ChainableReader targets, thus removing some of the complicated logic out of 
ChainReaderHelper.

Mime
View raw message