You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Steven Bower <sm...@alcyon.net> on 2013/11/15 16:40:30 UTC

SolrCoreAware

Under what circumstances will a handler that implements SolrCoreAware have
its inform() method called?

thanks,

steve

Re: SolrCoreAware

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Fri, Nov 15, 2013 at 11:19 PM, Steven Bower <sm...@alcyon.net> wrote:
> So its something that can happen multiple times during the lifetime of
> process, but i'm guessing something not occuring very often?

That's right.

>
> Also is there a way to hook the shutdown of the core?

You can use SolrCore.addCloseHook method.

>
> steve
>
>
> On Fri, Nov 15, 2013 at 12:08 PM, Alan Woodward <al...@flax.co.uk> wrote:
>
>> Hi Steven,
>>
>> It's called when the handler is created, either at SolrCore construction
>> time (solr startup or core reload) or the first time the handler is
>> requested if it's a lazy-loading handler.
>>
>> Alan Woodward
>> www.flax.co.uk
>>
>>
>> On 15 Nov 2013, at 15:40, Steven Bower wrote:
>>
>> > Under what circumstances will a handler that implements SolrCoreAware
>> have
>> > its inform() method called?
>> >
>> > thanks,
>> >
>> > steve
>>
>>



-- 
Regards,
Shalin Shekhar Mangar.

Re: SolrCoreAware

Posted by Steven Bower <sm...@alcyon.net>.
And the close hook will basically only be fired once during shutdown?


On Fri, Nov 15, 2013 at 1:07 PM, Chris Hostetter
<ho...@fucit.org>wrote:

>
> : So for a given instance of a handler it will only be called once during
> the
> : lifetime of that handler?
>
> correct (unless there is a bug somewhere)
>
> : Also, when the core is passed in as part of inform() is it guaranteed to
> be
> : ready to go? (ie I can start feeding content at this point?)
>
> Right, that's the point of the interface: way back in the day we had
> people writting plugins that were trying to use SolrCore from their init()
> methods and the SolrCore wasn't fully initialized yet (didn't have
> DirectUpdateHandler yet, didn't have all of hte RequestHandler's
> initialized, didn't have an openSearcher, etc...)
>
> the inform(SolrCore) method is called after the SolrCore is initialized,
> and all plugins hanging off of it have been init()ed ... you can still get
> into trouble if you write FooA.inform(SolrCore) such that it asks the
> SolrCore for for a pointer to some FooB plugin and expect that FooB's
> infomr(SolrCore) method has already been called -- because there is no
> garunteed order -- but the basic functionality and basic plugin
> initialization has all been done at that point.
>
>
> -Hoss
>

Re: SolrCoreAware

Posted by Chris Hostetter <ho...@fucit.org>.
: So for a given instance of a handler it will only be called once during the
: lifetime of that handler?

correct (unless there is a bug somewhere)

: Also, when the core is passed in as part of inform() is it guaranteed to be
: ready to go? (ie I can start feeding content at this point?)

Right, that's the point of the interface: way back in the day we had 
people writting plugins that were trying to use SolrCore from their init() 
methods and the SolrCore wasn't fully initialized yet (didn't have 
DirectUpdateHandler yet, didn't have all of hte RequestHandler's 
initialized, didn't have an openSearcher, etc...)

the inform(SolrCore) method is called after the SolrCore is initialized, 
and all plugins hanging off of it have been init()ed ... you can still get 
into trouble if you write FooA.inform(SolrCore) such that it asks the 
SolrCore for for a pointer to some FooB plugin and expect that FooB's 
infomr(SolrCore) method has already been called -- because there is no 
garunteed order -- but the basic functionality and basic plugin 
initialization has all been done at that point.


-Hoss

Re: SolrCoreAware

Posted by Steven Bower <sm...@alcyon.net>.
>>> it should be called only once during hte lifetime of a given plugin,
>>> usually not long after construction -- but it could be called many, many
>>> times in the lifetime of the solr process.

So for a given instance of a handler it will only be called once during the
lifetime of that handler?

Also, when the core is passed in as part of inform() is it guaranteed to be
ready to go? (ie I can start feeding content at this point?)

thanks,

steve




On Fri, Nov 15, 2013 at 12:52 PM, Chris Hostetter
<ho...@fucit.org>wrote:

>
> : So its something that can happen multiple times during the lifetime of
> : process, but i'm guessing something not occuring very often?
>
> it should be called only once during hte lifetime of a given plugin,
> usually not long after construction -- but it could be called many, many
> times in the lifetime of the solr process.
>
> : Also is there a way to hook the shutdown of the core?
>
> any object (SolrCoreAware or otherwise) can ask the SolrCore to add a
> CloseHook at anytime...
>
>
> https://lucene.apache.org/solr/4_5_1/solr-core/org/apache/solr/core/SolrCore.html#addCloseHook%28org.apache.solr.core.CloseHook%29
>
>
> -Hoss
>

Re: SolrCoreAware

Posted by Chris Hostetter <ho...@fucit.org>.
: So its something that can happen multiple times during the lifetime of
: process, but i'm guessing something not occuring very often?

it should be called only once during hte lifetime of a given plugin, 
usually not long after construction -- but it could be called many, many 
times in the lifetime of the solr process.

: Also is there a way to hook the shutdown of the core?

any object (SolrCoreAware or otherwise) can ask the SolrCore to add a 
CloseHook at anytime...

https://lucene.apache.org/solr/4_5_1/solr-core/org/apache/solr/core/SolrCore.html#addCloseHook%28org.apache.solr.core.CloseHook%29


-Hoss

Re: SolrCoreAware

Posted by Steven Bower <sm...@alcyon.net>.
So its something that can happen multiple times during the lifetime of
process, but i'm guessing something not occuring very often?

Also is there a way to hook the shutdown of the core?

steve


On Fri, Nov 15, 2013 at 12:08 PM, Alan Woodward <al...@flax.co.uk> wrote:

> Hi Steven,
>
> It's called when the handler is created, either at SolrCore construction
> time (solr startup or core reload) or the first time the handler is
> requested if it's a lazy-loading handler.
>
> Alan Woodward
> www.flax.co.uk
>
>
> On 15 Nov 2013, at 15:40, Steven Bower wrote:
>
> > Under what circumstances will a handler that implements SolrCoreAware
> have
> > its inform() method called?
> >
> > thanks,
> >
> > steve
>
>

Re: SolrCoreAware

Posted by Alan Woodward <al...@flax.co.uk>.
Hi Steven,

It's called when the handler is created, either at SolrCore construction time (solr startup or core reload) or the first time the handler is requested if it's a lazy-loading handler.  

Alan Woodward
www.flax.co.uk


On 15 Nov 2013, at 15:40, Steven Bower wrote:

> Under what circumstances will a handler that implements SolrCoreAware have
> its inform() method called?
> 
> thanks,
> 
> steve