mirror of https://github.com/apache/lucene.git
SOLR-927: remove synchronization from lazy loaded handler lookup
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@727564 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
aa9b5753ad
commit
663f27bd80
|
@ -229,23 +229,28 @@ final class RequestHandlers {
|
||||||
* Wait for the first request before initializing the wrapped handler
|
* Wait for the first request before initializing the wrapped handler
|
||||||
*/
|
*/
|
||||||
public void handleRequest(SolrQueryRequest req, SolrQueryResponse rsp) {
|
public void handleRequest(SolrQueryRequest req, SolrQueryResponse rsp) {
|
||||||
getWrappedHandler().handleRequest( req, rsp );
|
SolrRequestHandler handler = _handler;
|
||||||
|
if (handler == null) {
|
||||||
|
handler = getWrappedHandler();
|
||||||
|
}
|
||||||
|
handler.handleRequest( req, rsp );
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized SolrRequestHandler getWrappedHandler()
|
public synchronized SolrRequestHandler getWrappedHandler()
|
||||||
{
|
{
|
||||||
if( _handler == null ) {
|
if( _handler == null ) {
|
||||||
try {
|
try {
|
||||||
_handler = core.createRequestHandler(_className);
|
SolrRequestHandler handler = core.createRequestHandler(_className);
|
||||||
_handler.init( _args );
|
handler.init( _args );
|
||||||
|
|
||||||
if( _handler instanceof ResourceLoaderAware ) {
|
if( handler instanceof ResourceLoaderAware ) {
|
||||||
((ResourceLoaderAware)_handler).inform( core.getSolrConfig().getResourceLoader() );
|
((ResourceLoaderAware)_handler).inform( core.getSolrConfig().getResourceLoader() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( _handler instanceof SolrCoreAware ) {
|
if( handler instanceof SolrCoreAware ) {
|
||||||
((SolrCoreAware)_handler).inform( core );
|
((SolrCoreAware)handler).inform( core );
|
||||||
}
|
}
|
||||||
|
_handler = handler;
|
||||||
}
|
}
|
||||||
catch( Exception ex ) {
|
catch( Exception ex ) {
|
||||||
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "lazy loading error", ex );
|
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "lazy loading error", ex );
|
||||||
|
|
Loading…
Reference in New Issue