|
15 | 15 | import org.elasticsearch.common.util.concurrent.EsExecutors; |
16 | 16 | import org.elasticsearch.common.util.concurrent.ThreadContext; |
17 | 17 | import org.elasticsearch.core.TimeValue; |
| 18 | +import org.elasticsearch.logging.LogManager; |
| 19 | +import org.elasticsearch.logging.Logger; |
18 | 20 | import org.elasticsearch.node.Node; |
19 | 21 |
|
20 | 22 | import java.util.List; |
|
24 | 26 |
|
25 | 27 | public class VirtualThreadsExecutorBuilder extends ExecutorBuilder<VirtualThreadsExecutorSettings> { |
26 | 28 |
|
| 29 | + private static final Logger logger = LogManager.getLogger(VirtualThreadsExecutorBuilder.class); |
| 30 | + |
27 | 31 | private final boolean rejectAfterShutdown; |
| 32 | + private final List<Setting<?>> registeredSettings; |
28 | 33 |
|
29 | 34 | public VirtualThreadsExecutorBuilder(String name, boolean rejectAfterShutdown) { |
30 | 35 | super(name, false); |
31 | 36 | this.rejectAfterShutdown = rejectAfterShutdown; |
| 37 | + final String settingsPrefix = "thread_pool." + name + "."; |
| 38 | + // Don't apply any of these settings, just define them to make test failures go away |
| 39 | + registeredSettings = List.of( |
| 40 | + Setting.intSetting(settingsPrefix + "size", 999, 1, Setting.Property.NodeScope), |
| 41 | + Setting.intSetting(settingsPrefix + "max", 999, 1, Setting.Property.NodeScope), |
| 42 | + Setting.intSetting(settingsPrefix + "core", 999, 0, Setting.Property.NodeScope), |
| 43 | + Setting.intSetting(settingsPrefix + "queue_size", 999, Setting.Property.NodeScope) |
| 44 | + ); |
32 | 45 | } |
33 | 46 |
|
34 | 47 | @Override |
35 | 48 | public List<Setting<?>> getRegisteredSettings() { |
36 | | - return List.of(); |
| 49 | + return registeredSettings; |
37 | 50 | } |
38 | 51 |
|
39 | 52 | @Override |
40 | 53 | VirtualThreadsExecutorSettings getSettings(Settings settings) { |
41 | 54 | final String nodeName = Node.NODE_NAME_SETTING.get(settings); |
| 55 | + for (Setting<?> setting : registeredSettings) { |
| 56 | + if (setting.exists(settings)) { |
| 57 | + logger.warn("Ignoring setting [{}] for virtual thread pool [{}]", setting, name()); |
| 58 | + } |
| 59 | + } |
42 | 60 | return new VirtualThreadsExecutorSettings(nodeName); |
43 | 61 | } |
44 | 62 |
|
|
0 commit comments