RE: Solr plugin component resource cleanup?

2012-01-11 Thread karl.wright
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:

public void inform(SolrCore core)
{
  core.addCloseHook(new MyCloseHookInstance());
}

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.

Karl


From: ext Chris Hostetter [hossman_luc...@fucit.org]
Sent: Tuesday, January 03, 2012 12:55 PM
To: dev@lucene.apache.org
Subject: RE: Solr plugin component resource cleanup?

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

...that seems like an orthoginal problem to what i suggested...

: 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


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

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.



-Hoss

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


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



Re: Solr plugin component resource cleanup?

2012-01-11 Thread Erik Hatcher
Karl - you can get the core from SolrQueryRequest#getCore(), with 
SolrQueryRequest being passed into QParserPlugin#createParser.

Erik


On Jan 11, 2012, at 01:29 , karl.wri...@nokia.com karl.wri...@nokia.com 
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:
 
 public void inform(SolrCore core)
 {
  core.addCloseHook(new MyCloseHookInstance());
 }
 
 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.
 
 Karl
 
 
 From: ext Chris Hostetter [hossman_luc...@fucit.org]
 Sent: Tuesday, January 03, 2012 12:55 PM
 To: dev@lucene.apache.org
 Subject: RE: Solr plugin component resource cleanup?
 
 : 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:
 
 ...that seems like an orthoginal problem to what i suggested...
 
 : 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
 
 
 ...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.
 
 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.
 
 
 
 -Hoss
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
 For additional commands, e-mail: dev-h...@lucene.apache.org
 
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
 For additional commands, e-mail: dev-h...@lucene.apache.org
 


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



RE: Solr plugin component resource cleanup?

2012-01-11 Thread karl.wright
Thanks, Erik, this is not ideal but it will work for my purposes.  But it seems 
a shame that the whole SolrCoreAware setup as it was designed turned out to be 
so problematic.

Karl

-Original Message-
From: ext Erik Hatcher [mailto:erik.hatc...@gmail.com] 
Sent: Wednesday, January 11, 2012 3:53 AM
To: dev@lucene.apache.org
Subject: Re: Solr plugin component resource cleanup?

Karl - you can get the core from SolrQueryRequest#getCore(), with 
SolrQueryRequest being passed into QParserPlugin#createParser.

Erik


On Jan 11, 2012, at 01:29 , karl.wri...@nokia.com karl.wri...@nokia.com 
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:
 
 public void inform(SolrCore core)
 {
  core.addCloseHook(new MyCloseHookInstance()); }
 
 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.
 
 Karl
 
 
 From: ext Chris Hostetter [hossman_luc...@fucit.org]
 Sent: Tuesday, January 03, 2012 12:55 PM
 To: dev@lucene.apache.org
 Subject: RE: Solr plugin component resource cleanup?
 
 : 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:
 
 ...that seems like an orthoginal problem to what i suggested...
 
 : 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
 
 
 ...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.
 
 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.
 
 
 
 -Hoss
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For 
 additional commands, e-mail: dev-h...@lucene.apache.org
 
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For 
 additional commands, e-mail: dev-h...@lucene.apache.org
 


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


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



RE: Solr plugin component resource cleanup?

2012-01-08 Thread karl.wright
I created a ticket for this: SOLR-3015.  I hope there's a simple solution and I 
can just close it, but if not I will experiment and try to produce a patch.

Karl


From: Wright Karl (Nokia-LC/Boston)
Sent: Monday, January 02, 2012 11:02 AM
To: dev@lucene.apache.org
Subject: RE: Solr plugin component resource cleanup?

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: 
[org.apache.solr.request.SolrRequestHandler]
[org.apache.solr.response.QueryResponseWriter] 
[org.apache.solr.handler.component.SearchComponent] 
[org.apache.solr.update.processor.UpdateRequestProcessorFactory] 
[org.apache.solr.handler.component.ShardHandlerFactory]

Any further suggestions?

Karl


From: ext Chris Hostetter [hossman_luc...@fucit.org]
Sent: Tuesday, December 27, 2011 7:19 PM
To: dev@lucene.apache.org
Subject: Re: Solr plugin component resource cleanup?

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
: be nothing for this in the NamedListInitializedPlugin interface, and yet
: if you allocate a resource the test framework warns you about it.


-Hoss

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


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



RE: Solr plugin component resource cleanup?

2012-01-03 Thread Chris Hostetter

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

...that seems like an orthoginal problem to what i suggested...

: 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


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

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.



-Hoss

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



RE: Solr plugin component resource cleanup?

2012-01-02 Thread karl.wright
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: 
[org.apache.solr.request.SolrRequestHandler]
[org.apache.solr.response.QueryResponseWriter] 
[org.apache.solr.handler.component.SearchComponent] 
[org.apache.solr.update.processor.UpdateRequestProcessorFactory] 
[org.apache.solr.handler.component.ShardHandlerFactory]

Any further suggestions?

Karl


From: ext Chris Hostetter [hossman_luc...@fucit.org]
Sent: Tuesday, December 27, 2011 7:19 PM
To: dev@lucene.apache.org
Subject: Re: Solr plugin component resource cleanup?

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
: be nothing for this in the NamedListInitializedPlugin interface, and yet
: if you allocate a resource the test framework warns you about it.


-Hoss

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


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



Re: Solr plugin component resource cleanup?

2011-12-27 Thread Chris Hostetter

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 
: be nothing for this in the NamedListInitializedPlugin interface, and yet 
: if you allocate a resource the test framework warns you about it.


-Hoss

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