[
https://issues.apache.org/jira/browse/SOLR-1107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13924450#comment-13924450
]
Eugen Paraschiv commented on SOLR-1107:
---------------------------------------
This would be a really useful thing - a hook into the SOLR lifecycle. A usecase
would be a custom QueryResponseWriter - having the option to set things up and
tear things down would definitely help.
> Lifecycle management for CoreContainer before SolrCore-s are initialized
> -------------------------------------------------------------------------
>
> Key: SOLR-1107
> URL: https://issues.apache.org/jira/browse/SOLR-1107
> Project: Solr
> Issue Type: New Feature
> Components: search
> Environment: Java 5
> Reporter: Karthik K
> Attachments: SOLR-1107.patch
>
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> CoreContainer -> load creates and initializes SolrCore-s .
> For some practical purposes - we may want to do some initialization /
> injection before the (custom) request handlers and the (custom) search
> components of the multiple cores are getting instantiated.
> Hence we need a guaranteed way of providing lifecycle management that gets
> invoked once before the rest ( and hence , orthogonally a destroy() needs to
> be invoked if there is an error in initialization ).
> New class added: CoreContainerLifecycleListener ( that needs to be
> implemented by custom lifecycle listeners )
> <code>
> */
> public abstract class CoreContainerLifecycleListener {
> /**
> * Guaranteed to be called before the initialization of the individual solr
> * cores.
> *
> * @param props
> * Properties loaded from the config file. <br >
> * <b>Important: This could be null </b>
> */
> public abstract void onInit(final Properties props);
> /**
> * Guaranteed to be called when an exception occurs in the initialization of
> * the solr core container.
> */
> public abstract void onDestroy();
> }
> </code>
> Corresponding representation in solr.xml :
> <solr>
> <lifecycles>
> <lifecycle type="my.class.type.from.CoreContainerLifecycleListener"
> />
> <lifecycle
> type="my.class.type2.from.CoreContainerLifecycleListener" >
> <property name="key" value="value" />
> </lifecycle>
> </lifecycles>
> </solr>
> 2 CoreContainerLifecycleListener-s are instantiated and the method
> onInit(Properties) is invoked on the same. In case of a container
> initialization error- onDestroy() is called too.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]