Yes you are right. But to avoid synchronization I would remove lazy
initialization in this place. In fact I am not sure if we have any
gain from lazy initialization of ArrayFile.Reader in this class - is
there any particular reason it is coded this way?
Regards
Piotr

On 8/19/05, Alan Wang <[EMAIL PROTECTED]> wrote:
> The code below caused some ParseText to be opened fo 10 times. When the
> segments is added and deleted dynamic, the file handles only be closed once.
> It subdue the stability.
> 
> net.nutch.searcher.FetchedSegments.java:73
> //-----------------------------------------------------------------------
> 
>       if (text == null) {
>         this.text = new ArrayFile.Reader
>           (nfs, new File(segmentDir, ParseText.DIR_NAME).toString());
>       }
> //-----------------------------------------------------------------------
> 
> new code is listed here:
> 
> //-----------------------------------------------------------------------
> synchronized(this){
>       if (text == null) {
>         this.text = new ArrayFile.Reader
>           (nfs, new File(segmentDir, ParseText.DIR_NAME).toString());
>       }
> }
> //-----------------------------------------------------------------------
> 
> Any comment?
> 
> Cheers,
> Alan
> 
>


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Nutch-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nutch-developers

Reply via email to