Skip to content

Commit 61687b1

Browse files
committed
move settings registration and test
1 parent 6202a70 commit 61687b1

3 files changed

Lines changed: 58 additions & 270 deletions

File tree

server/src/internalClusterTest/java/org/elasticsearch/common/util/concurrent/ThreadPoolHotThreadsIT.java

Lines changed: 0 additions & 266 deletions
This file was deleted.

server/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@
138138
import org.elasticsearch.snapshots.RestoreService;
139139
import org.elasticsearch.snapshots.SnapshotShutdownProgressTracker;
140140
import org.elasticsearch.snapshots.SnapshotsService;
141-
import org.elasticsearch.threadpool.ScalingExecutorBuilder;
142141
import org.elasticsearch.threadpool.ThreadPool;
143142
import org.elasticsearch.transport.RemoteClusterPortSettings;
144143
import org.elasticsearch.transport.RemoteClusterSettings;
@@ -562,9 +561,6 @@ public void apply(Settings value, Settings current, Settings previous) {
562561
ThreadPool.LATE_TIME_INTERVAL_WARN_THRESHOLD_SETTING,
563562
ThreadPool.SLOW_SCHEDULER_TASK_WARN_THRESHOLD_SETTING,
564563
ThreadPool.WRITE_THREAD_POOLS_EWMA_ALPHA_SETTING,
565-
ScalingExecutorBuilder.HOT_THREADS_ON_LARGE_QUEUE_SIZE_THRESHOLD_SETTING,
566-
ScalingExecutorBuilder.HOT_THREADS_ON_LARGE_QUEUE_DURATION_THRESHOLD_SETTING,
567-
ScalingExecutorBuilder.HOT_THREADS_ON_LARGE_QUEUE_INTERVAL_SETTING,
568564
FastVectorHighlighter.SETTING_TV_HIGHLIGHT_MULTI_VALUE,
569565
Node.BREAKER_TYPE_KEY,
570566
OperationRouting.USE_ADAPTIVE_REPLICA_SELECTION_SETTING,
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* ELASTICSEARCH CONFIDENTIAL
3+
* __________________
4+
*
5+
* Copyright Elasticsearch B.V. All rights reserved.
6+
*
7+
* NOTICE: All information contained herein is, and remains
8+
* the property of Elasticsearch B.V. and its suppliers, if any.
9+
* The intellectual and technical concepts contained herein
10+
* are proprietary to Elasticsearch B.V. and its suppliers and
11+
* may be covered by U.S. and Foreign Patents, patents in
12+
* process, and are protected by trade secret or copyright
13+
* law. Dissemination of this information or reproduction of
14+
* this material is strictly forbidden unless prior written
15+
* permission is obtained from Elasticsearch B.V.
16+
*/
17+
18+
package org.elasticsearch.common.util.concurrent;
19+
20+
import org.elasticsearch.common.settings.Settings;
21+
22+
import java.util.concurrent.TimeUnit;
23+
import java.util.function.LongSupplier;
24+
25+
import static org.elasticsearch.test.ESTestCase.randomIdentifier;
26+
27+
public class EsThreadPoolExecutorTestHelper {
28+
29+
public static EsExecutors.HotThreadsOnLargeQueueConfig getHotThreadsOnLargeQueueConfig(EsThreadPoolExecutor executor) {
30+
return executor.getHotThreadsOnLargeQueueConfig();
31+
}
32+
33+
public static long getStartTimeOfLargeQueue(EsThreadPoolExecutor executor) {
34+
return executor.getStartTimeOfLargeQueue();
35+
}
36+
37+
public static EsThreadPoolExecutor newEsThreadPoolExecutor(
38+
String name,
39+
int corePoolSize,
40+
int maximumPoolSize,
41+
EsExecutors.HotThreadsOnLargeQueueConfig hotThreadsOnLargeQueueConfig,
42+
LongSupplier currentTimeMillisSupplier
43+
) {
44+
return new EsThreadPoolExecutor(
45+
name,
46+
corePoolSize,
47+
maximumPoolSize,
48+
5,
49+
TimeUnit.MINUTES,
50+
new EsExecutors.ExecutorScalingQueue<>(),
51+
EsExecutors.daemonThreadFactory(randomIdentifier(), name),
52+
new EsExecutors.ForceQueuePolicy(false, false),
53+
new ThreadContext(Settings.EMPTY),
54+
hotThreadsOnLargeQueueConfig,
55+
currentTimeMillisSupplier
56+
);
57+
}
58+
}

0 commit comments

Comments
 (0)