You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/07/16 10:48:12 UTC
[lucene-solr] branch reference_impl updated: @207 - Finally,
fix this little guy.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/reference_impl by this push:
new ab02d56 @207 - Finally, fix this little guy.
ab02d56 is described below
commit ab02d56774953d5a7b112771685dc39b9b8b1386
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Thu Jul 16 05:47:48 2020 -0500
@207 - Finally, fix this little guy.
---
.../solr/client/solrj/impl/Http2SolrClient.java | 40 ++++++++++++----------
.../org/apache/solr/common/cloud/SolrZkClient.java | 1 -
.../solr/common/util/SolrQueuedThreadPool.java | 6 ++--
3 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
index 62fb270..8e93642 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
@@ -128,20 +128,20 @@ public class Http2SolrClient extends SolrClient {
private static final List<String> errPath = Arrays.asList("metadata", "error-class");
private final Map<String, String> headers;
- private HttpClient httpClient;
+ private volatile HttpClient httpClient;
private volatile Set<String> queryParams = Collections.emptySet();
private int idleTimeout;
- private ResponseParser parser = new BinaryResponseParser();
+ private volatile ResponseParser parser = new BinaryResponseParser();
private volatile RequestWriter requestWriter = new BinaryRequestWriter();
- private List<HttpListenerFactory> listenerFactory = new LinkedList<>();
- private AsyncTracker asyncTracker = new AsyncTracker();
+ private final Set<HttpListenerFactory> listenerFactory = ConcurrentHashMap.newKeySet();
+ private final AsyncTracker asyncTracker = new AsyncTracker();
/**
* The URL of the Solr server.
*/
- private String serverBaseUrl;
- private boolean closeClient;
- private SolrQueuedThreadPool httpClientExecutor;
+ private volatile String serverBaseUrl;
+ private volatile boolean closeClient;
+ private volatile SolrQueuedThreadPool httpClientExecutor;
protected Http2SolrClient(String serverBaseUrl, Builder builder) {
if (serverBaseUrl != null) {
@@ -190,11 +190,11 @@ public class Http2SolrClient extends SolrClient {
private HttpClient createHttpClient(Builder builder) {
HttpClient httpClient;
- BlockingArrayQueue<Runnable> queue = new BlockingArrayQueue<>(256, 256);
+// BlockingArrayQueue<Runnable> queue = new BlockingArrayQueue<>(256, 256);
// httpClientExecutor = new ExecutorUtil.MDCAwareThreadPoolExecutor(Integer.getInteger("solr.http2solrclient.corepool.size", 2),
// Integer.getInteger("solr.http2solrclient.maxpool.size", 10), Integer.getInteger("solr.http2solrclient.pool.keepalive", 3000),
// TimeUnit.MILLISECONDS, queue, new SolrNamedThreadFactory("h2sc"));
- httpClientExecutor = new SolrQueuedThreadPool("httpClient", false);
+
SslContextFactory.Client sslContextFactory;
boolean ssl;
@@ -224,16 +224,18 @@ public class Http2SolrClient extends SolrClient {
httpClient = new HttpClient(transport, sslContextFactory);
httpClient.setMaxConnectionsPerDestination(4);
}
-
- httpClient.setExecutor(httpClientExecutor);
- httpClient.setStrictEventOrdering(false);
- httpClient.setConnectBlocking(false);
- httpClient.setFollowRedirects(false);
- httpClient.setMaxRequestsQueuedPerDestination(asyncTracker.getMaxRequestsQueuedPerDestination());
- httpClient.setUserAgentField(new HttpField(HttpHeader.USER_AGENT, AGENT));
- httpClient.setIdleTimeout(idleTimeout);
- if (builder.connectionTimeout != null) httpClient.setConnectTimeout(builder.connectionTimeout);
+ httpClientExecutor = new SolrQueuedThreadPool("httpClient", false);
try {
+ httpClientExecutor.start();
+ httpClient.setExecutor(httpClientExecutor);
+ httpClient.setStrictEventOrdering(false);
+ httpClient.setConnectBlocking(false);
+ httpClient.setFollowRedirects(false);
+ httpClient.setMaxRequestsQueuedPerDestination(asyncTracker.getMaxRequestsQueuedPerDestination());
+ httpClient.setUserAgentField(new HttpField(HttpHeader.USER_AGENT, AGENT));
+ httpClient.setIdleTimeout(idleTimeout);
+ if (builder.connectionTimeout != null) httpClient.setConnectTimeout(builder.connectionTimeout);
+
httpClient.start();
} catch (Exception e) {
throw new RuntimeException(e);
@@ -249,7 +251,7 @@ public class Http2SolrClient extends SolrClient {
if (closeClient) {
closer.collect(() -> {
try {
- httpClient.setStopTimeout(1);
+ // httpClient.setStopTimeout();
httpClient.stop();
} catch (InterruptedException e) {
ParWork.propegateInterrupt(e);
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java b/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
index 9589c47..499b729 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
@@ -915,7 +915,6 @@ public class SolrZkClient implements Closeable {
zkConnManagerCallbackExecutor.shutdownNow();
zkCallbackExecutor.shutdownNow();
try (ParWork worker = new ParWork(this, true)) {
-
worker.add("ZkClientExecutors&ConnMgr", zkCallbackExecutor, zkConnManagerCallbackExecutor, connManager, keeper);
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java b/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java
index 47372db..d236a78 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java
@@ -68,7 +68,7 @@ public class SolrQueuedThreadPool extends QueuedThreadPool implements Closeable
// }
public void close() {
- TimeOut timeout = new TimeOut(5, TimeUnit.SECONDS, TimeSource.NANO_TIME);
+ TimeOut timeout = new TimeOut(15, TimeUnit.SECONDS, TimeSource.NANO_TIME);
while (getBusyThreads() != 0) {
if (timeout.hasTimedOut()) {
throw new RuntimeException("Timed out waiting for SolrQueuedThreadPool to close");
@@ -91,9 +91,7 @@ public class SolrQueuedThreadPool extends QueuedThreadPool implements Closeable
@Override
protected void doStop() throws Exception {
if (!killStop) {
- //while (!isStopped()) {
- super.doStop();
- //}
+ super.doStop();
}
}