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
> 
>

Reply via email to