You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Kay Kay (JIRA)" <ji...@apache.org> on 2009/04/08 21:15:12 UTC

[jira] Created: (SOLR-1107) Lifecycle management for CoreContainer before SolrCore-s are initialized

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.


[jira] Updated: (SOLR-1107) Lifecycle management for CoreContainer before SolrCore-s are initialized

Posted by "Kay Kay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-1107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kay Kay updated SOLR-1107:
--------------------------

    Attachment: SOLR-1107.patch

New class added  = CoreContainerLifecycleEventListener . 

CoreContainer changes to process LifecycleEventListeners as well. 

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