Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3AE83D589 for ; Tue, 3 Jul 2012 16:06:42 +0000 (UTC) Received: (qmail 52930 invoked by uid 500); 3 Jul 2012 16:06:40 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 52839 invoked by uid 500); 3 Jul 2012 16:06:40 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 52831 invoked by uid 99); 3 Jul 2012 16:06:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jul 2012 16:06:40 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FSL_RCVD_USER,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jochenhebbrecht@gmail.com designates 209.85.212.48 as permitted sender) Received: from [209.85.212.48] (HELO mail-vb0-f48.google.com) (209.85.212.48) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jul 2012 16:06:35 +0000 Received: by vbjk17 with SMTP id k17so5447422vbj.35 for ; Tue, 03 Jul 2012 09:06:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=zklQNpZRWN4/H7g0uri5uEFCHSB+4gw44EnV6EuqusA=; b=KIXEEVfM/mmKrEA7ZBVWU3GxKsVecChRzVwKd60B6aq5MXHG3imeJsJcOrRqllHem4 rsxfg7bW5rHtDAuwFh+dc+DADiHbiGrYBnuuT0d7Qs6sPxo097WN3S7WH0ZuncztJ8P2 Bj8eA5u8QyK97MPNwHfGXRuxLxxBrh54BlGyzP1U/QToAj/b3H1NDnnsyByIMvDupAGb BnE3ayoWm4+omGY1TJ3alSxDSkIl4Qqn/H42MY++ZHbH6XwQOqxdM3/rufSfROjLbF7V lx4W9uRS75lAbBgffYqFP/UBLQgs1FEnenokE8p8qA4Wq5sojy6ORKueLGSBs9OMUhx9 xqWg== MIME-Version: 1.0 Received: by 10.220.214.148 with SMTP id ha20mr8498585vcb.5.1341331575022; Tue, 03 Jul 2012 09:06:15 -0700 (PDT) Received: by 10.220.154.81 with HTTP; Tue, 3 Jul 2012 09:06:14 -0700 (PDT) In-Reply-To: <1341241866.27338.22.camel@localhost> References: <1341241866.27338.22.camel@localhost> Date: Tue, 3 Jul 2012 18:06:14 +0200 Message-ID: Subject: Re: Best practise closing Lucene index From: Jochen Hebbrecht To: java-user@lucene.apache.org, tkrah@fachschaft.imn.htwk-leipzig.de Content-Type: multipart/alternative; boundary=bcaec54d4d380e231e04c3ef1841 X-Virus-Checked: Checked by ClamAV on apache.org --bcaec54d4d380e231e04c3ef1841 Content-Type: text/plain; charset=ISO-8859-1 Thanks. We are currently more thinking of a statefull EJB. We are thinking to use the @Remove annotation ... 2012/7/2 Torsten Krah > I you really want a per session based reader, use a > > > http://docs.oracle.com/javaee/5/api/javax/servlet/http/HttpSessionListener.html > > and create the object there in sessionCreated and destroy the Reader in > sessionDestroyed. > You seam component can get the create objected under a well known name > you've choosen from the session. > > So you won't miss to close the object and won't leak file handles. > > regards > > Torsten > > Am Montag, den 02.07.2012, 15:44 +0200 schrieb Jochen Hebbrecht: > > Hi all, > > > > I currently have a Seam component which is in my session. This component > is > > holding (private attribute) a custom "Lucene object" which opens a Lucene > > index in the constructor. When I want to search, I use the "Lucene > object" > > in my session which uses the already opened Lucene index. > > So when I want to search on something else, I can still reuse the already > > opened index. > > > > But now, I don't have some Java logic which closes the reader. Shouldn't > > this be done in some method like the destroy() method (which is called by > > te JVM)? > > Or is it ok if I don't manually close the reader? > > > > Thanks, > > Jochen > > --bcaec54d4d380e231e04c3ef1841--