[ https://issues.apache.org/jira/browse/SOLR-915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12657081#action_12657081 ]
Kay Kay commented on SOLR-915: ------------------------------ | Another issue with calling close hooks in parallel is thread safety and race conditions which could cause double closes or null pointer exceptions, etc. Ideally the close hooks should all be independent of each other without any order among them. When we register multiple handlers (through <requesthandler> in solrconfig.xml ) - they might register their own closehooks as necessary. In that case - the order becomes totally irrelevant ( so the member of CloseHooks is better defined as a Collection , rather than a List, irrespective of if we have parallelism or not ). Maintaining the same order as the order of definition in solrconfig.xml is not very intuitive since it is possible for people to move around content in the .xml file. If they were going to totally parallel - then there is not much scope for race conditions since they do not share any object ( closeHook.close() has no objects ) and it merely serves as a notification to a hook . doubleCloses, are not possible since there seems to be an AtomicInteger right at the beginning of close() which executes only if the counter is set to 0 . I did not understand the part about NPE , though. > SolrCore;close() - scope to exploit parallelism among the number of > closeHooks > -------------------------------------------------------------------------------- > > Key: SOLR-915 > URL: https://issues.apache.org/jira/browse/SOLR-915 > Project: Solr > Issue Type: Improvement > Components: search > Environment: Tomcat 6, JRE 6 > Reporter: Kay Kay > Assignee: Ryan McKinley > Priority: Minor > Fix For: 1.4 > > Attachments: SOLR-915.patch, SOLR-915.patch, SOLR-915.patch > > Original Estimate: 96h > Remaining Estimate: 96h > > In SolrCore: close() - all the way towards the end of the function - there > seems to be a sequential list of close method invocation. > if( closeHooks != null ) { > for( CloseHook hook : closeHooks ) { > hook.close( this ); > } > } > I believe this has scope to be parallelized ( actually the entire sequence of > close operations , updateHandler,close() etc.) - by means of launching them > in separate threads from an ExecutorService , for a much faster shutdown as > the process definitely does not need to be sequential. > This becomes all the more important in the multi-core context when we might > want to shutdown and restart a SolrCore altogether. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.