lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hiroaki Kawai <ka...@apache.org>
Subject Re: Token implementation
Date Tue, 15 Jul 2008 09:25:13 GMT
DM Smith <dmsmith555@gmail.com> wrote:
> Hiroaki Kawai wrote:
> > DM Smith <dmsmith555@gmail.com> wrote:
> >   
> >> On Jul 11, 2008, at 9:42 PM, Hiroaki Kawai wrote:
> >>
> >>     
> >>> Another suggestion from me:
> >>> How about making token object as an singleton?
> >>>       
> >> Would that work for a multi-threaded application?
> >>     
> >
> > Of cource. We should make that thread local singleton.
> >   
> 
> In core and contrib, there are times where more than one token is used 
> at a time. In a few places they are put into collections.
> 
> So a singleton wouldn't work.

I'd suggest a factory method to get a thread local singleton.
If one want to new a token, it may be possible, but it is not 
encouraged to do so. 
If there is more than one token, that is not good because 
we are focusing on reducing new object. Such code might be
refactored to be more simple.




---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message