lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kay Kay (JIRA)" <>
Subject [jira] Created: (SOLR-1107) Lifecycle management for CoreContainer before SolrCore-s are initialized
Date Wed, 08 Apr 2009 19:15:12 GMT
Lifecycle management for CoreContainer before SolrCore-s are initialized 

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

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 ) 

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();

Corresponding representation in solr.xml : 

          <lifecycle type="my.class.type.from.CoreContainerLifecycleListener" />
            <lifecycle type="my.class.type2.from.CoreContainerLifecycleListener" >
                  <property name="key" value="value" />

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.

View raw message