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: Kay Kay
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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.