From java-dev-return-26417-apmail-lucene-java-dev-archive=lucene.apache.org@lucene.apache.org Tue Jul 15 09:26:23 2008 Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 96640 invoked from network); 15 Jul 2008 09:26:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Jul 2008 09:26:23 -0000 Received: (qmail 5914 invoked by uid 500); 15 Jul 2008 09:26:16 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 5872 invoked by uid 500); 15 Jul 2008 09:26:16 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 5855 invoked by uid 99); 15 Jul 2008 09:26:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jul 2008 02:26:16 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.9] (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 15 Jul 2008 09:25:32 +0000 Received: (qmail 96548 invoked from network); 15 Jul 2008 09:25:55 -0000 Received: from localhost (127.0.0.1) by localhost with SMTP; 15 Jul 2008 09:25:55 -0000 Date: Tue, 15 Jul 2008 18:25:13 +0900 From: Hiroaki Kawai X-Mailer: EdMax Ver5.16 MIME-Version: 1.0 To: java-dev@lucene.apache.org Subject: Re: Token implementation Message-Id: <20080715182513.YWQUZE1HWV@apache.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit In-Reply-To: <487B75A9.30007@gmail.com> References: <487B75A9.30007@gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org DM Smith wrote: > Hiroaki Kawai wrote: > > DM Smith 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