Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 06FD49E8E for ; Wed, 11 Jan 2012 08:54:14 +0000 (UTC) Received: (qmail 57613 invoked by uid 500); 11 Jan 2012 08:54:12 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 57134 invoked by uid 500); 11 Jan 2012 08:53:54 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 57099 invoked by uid 99); 11 Jan 2012 08:53:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jan 2012 08:53:45 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of erik.hatcher@gmail.com designates 209.85.214.176 as permitted sender) Received: from [209.85.214.176] (HELO mail-tul01m020-f176.google.com) (209.85.214.176) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jan 2012 08:53:38 +0000 Received: by obbwd1 with SMTP id wd1so869672obb.35 for ; Wed, 11 Jan 2012 00:53:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=vaLgMjO148v5wAGtUa0sg04k0mxrjnEFItqFK8eFVSY=; b=nMXXvlComcshi/zbvzb+w5LhFX9hczqYdDPRbBhPVlyefr0YF8sNzJKM/Pybe31v8R cjIrRv1ZEXhWCEuZKIzDpAVMDfEezqrCZxDfWW1z/GofCC/9Ziut7uOUO3Cy+7jESMu7 FktcDYoVsr4M7FBmBuSyoanxsoUxjBwvsIxks= Received: by 10.182.42.37 with SMTP id k5mr21465039obl.40.1326271997164; Wed, 11 Jan 2012 00:53:17 -0800 (PST) Received: from [172.17.156.162] ([12.69.17.130]) by mx.google.com with ESMTPS id h1sm911612obj.3.2012.01.11.00.53.15 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 11 Jan 2012 00:53:16 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) Subject: Re: Solr plugin component resource cleanup? From: Erik Hatcher In-Reply-To: <0BA6D34688263E4F8E6152478F7C336C169CDD32@008-AM1MPN1-006.mgdnok.nokia.com> Date: Wed, 11 Jan 2012 01:53:13 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <084F1E09-2946-4997-9310-8FE41CA56C18@gmail.com> References: <0BA6D34688263E4F8E6152478F7C336C01CE41D0@008-AM1MPN1-001.mgdnok.nokia.com>, <0BA6D34688263E4F8E6152478F7C336C01CE7163@008-AM1MPN1-001.mgdnok.nokia.com>, <0BA6D34688263E4F8E6152478F7C336C169CDD32@008-AM1MPN1-006.mgdnok.nokia.com> To: dev@lucene.apache.org X-Mailer: Apple Mail (2.1084) X-Virus-Checked: Checked by ClamAV on apache.org Karl - you can get the core from SolrQueryRequest#getCore(), with = SolrQueryRequest being passed into QParserPlugin#createParser. Erik On Jan 11, 2012, at 01:29 , = wrote: > "SolrCoreAware" and "CloseHook" are related in that you need a = SolrCore object in order to call SolrCore.addCloseHook(). Indeed, the = javadoc for the CloseHook interface states that the expected way you are = supposed to use this in a plugin is via something like this: >=20 > public void inform(SolrCore core) > { > core.addCloseHook(new MyCloseHookInstance()); > } >=20 > If you have another way I can get hold of the right SolrCore object = from within a QParserPlugin, please let me know. I've opened SOLR-3015 = to track this issue. >=20 > Karl >=20 > ________________________________________ > From: ext Chris Hostetter [hossman_lucene@fucit.org] > Sent: Tuesday, January 03, 2012 12:55 PM > To: dev@lucene.apache.org > Subject: RE: Solr plugin component resource cleanup? >=20 > : This works fine for a SearchComponent, but if I try this for a = QParserPlugin I get the following: > : > : [junit] org.apache.solr.common.SolrException: Invalid 'Aware' > : object: org.apache.solr.mcf.ManifoldCFQParserPlugin@18941f7 -- > : org.apache.solr.util.plugin.SolrCoreAware must be an instance of: >=20 > ...that seems like an orthoginal problem to what i suggested... >=20 > : take a look at the "CloseHook" API and SolrCore.addCloseHook(...) > : > : : Is there a preferred time/manner for a Solr component (e.g. a > : : SearchComponent) to clean up resources that have been allocated = during > : : the time of its existence, other than via a finalizer? There = seems to >=20 >=20 > ...any object can call SolrCore.addCloseHook, regardless of wether or = not > that class implements SolrCoreAware (two ideas are unrelated). The = list > of classes that implement SolrCoreAware has always been limited > to prevent circular lifecycle problems. >=20 > what type of resouces are you trying to clean up? are they really > specific to the initialization of the QParserPlugin (which shoulds = *VERY* > unusual), or to the QParsers that it creates? because you can always = call > addCloseHook in the createParser method. >=20 >=20 >=20 > -Hoss >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org > For additional commands, e-mail: dev-help@lucene.apache.org >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org > For additional commands, e-mail: dev-help@lucene.apache.org >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org