forked from apache/solr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix LBHttp2SolrClient zombie testing
Zombie-resurrection was broken in LBHttp2SolrClient because the default collection wasn't being taken into account on these requests. The root of the problem is the way that LBHttp2 takes in an already-constructed SolrClient, making it difficult to set the default collection. (In contrast, LBHttpSolrClient creates a different client for each base URL using a common Builder - this allows it to property set the default collection.) This commit fixes this by created a 'DelegatingSolrClient' that LBHttp2 can use internally around its single Http2SolrClient. The default collection is set on this 'Delegating' wrapper, so that it gets picked up by the zombie-resurrection logic.
- Loading branch information
1 parent
410676b
commit e70b2e2
Showing
11 changed files
with
147 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
solr/solrj/src/java/org/apache/solr/client/solrj/impl/DelegatingSolrClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.solr.client.solrj.impl; | ||
|
||
import java.io.IOException; | ||
import org.apache.solr.client.solrj.SolrClient; | ||
import org.apache.solr.client.solrj.SolrRequest; | ||
import org.apache.solr.client.solrj.SolrServerException; | ||
import org.apache.solr.client.solrj.util.ClientUtils; | ||
import org.apache.solr.common.util.NamedList; | ||
|
||
/** | ||
* A {@link SolrClient} implementation that defers to a delegate SolrClient object. | ||
* | ||
* <p>Callers are responsible for closing the 'delegate' client themselves. {@link | ||
* DelegatingSolrClient#close()} is a no-op | ||
*/ | ||
public class DelegatingSolrClient extends SolrClient { | ||
|
||
private final SolrClient delegate; | ||
|
||
public DelegatingSolrClient(SolrClient delegate) { | ||
this.delegate = delegate; | ||
} | ||
|
||
@Override | ||
public NamedList<Object> request(SolrRequest<?> request, String collection) | ||
throws SolrServerException, IOException { | ||
if (ClientUtils.shouldApplyDefaultCollection(collection, request)) { | ||
collection = getDefaultCollection(); | ||
} | ||
return delegate.request(request, collection); | ||
} | ||
|
||
@Override | ||
public void close() throws IOException { | ||
/* No-op */ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters