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/08/20 01:33:38 UTC
[lucene-solr] 04/04: @572 Fix non test shutdown.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
commit 3382f12aeb5f64d1cd273bcfdd14d4f09602f286
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Wed Aug 19 20:29:35 2020 -0500
@572 Fix non test shutdown.
---
.../org/apache/solr/common/ParWorkExecutor.java | 46 +++++++++++-----------
1 file changed, 22 insertions(+), 24 deletions(-)
diff --git a/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java b/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java
index dc64869..9e2ead1 100644
--- a/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java
+++ b/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java
@@ -1,3 +1,19 @@
+/*
+ * 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.common;
import org.slf4j.Logger;
@@ -14,7 +30,7 @@ import java.util.concurrent.atomic.AtomicInteger;
public class ParWorkExecutor extends ThreadPoolExecutor {
private static final Logger log = LoggerFactory
.getLogger(MethodHandles.lookup().lookupClass());
- public static final int KEEP_ALIVE_TIME = 5000;
+ public static final int KEEP_ALIVE_TIME = 15000;
private static AtomicInteger threadNumber = new AtomicInteger(0);
private volatile boolean closed;
@@ -32,17 +48,14 @@ public class ParWorkExecutor extends ThreadPoolExecutor {
super(corePoolsSize, maxPoolsSize, keepalive, TimeUnit.MILLISECONDS, workQueue
, new ThreadFactory() {
- ThreadGroup group;
+ @Override
+ public Thread newThread(Runnable r) {
+ ThreadGroup group;
- {
SecurityManager s = System.getSecurityManager();
- group = (s != null) ?
- s.getThreadGroup() :
+ group = (s != null)? s.getThreadGroup() :
Thread.currentThread().getThreadGroup();
- }
- @Override
- public Thread newThread(Runnable r) {
Thread t = new Thread(group,
name + threadNumber.getAndIncrement()) {
public void run() {
@@ -53,29 +66,14 @@ public class ParWorkExecutor extends ThreadPoolExecutor {
}
}
};
- //t.setDaemon(true);
-
- // t.setPriority(priority);
+ t.setDaemon(true);
return t;
}
});
-
- //setRejectedExecutionHandler(new CallerRunsPolicy());
}
public void shutdown() {
this.closed = true;
-// if (!isShutdown()) {
-// // wake up idle threads!
-// for (int i = 0; i < getPoolSize(); i++) {
-// submit(new Runnable() {
-// @Override
-// public void run() {
-//
-// }
-// });
-// }
-// }
super.shutdown();
}
}