@@ -48,13 +48,17 @@ public void testScalingThreadPoolConfiguration() throws InterruptedException {
4848 core = "generic" .equals (threadPoolName ) ? 4 : 1 ; // the defaults
4949 }
5050
51+ final int availableProcessors = Runtime .getRuntime ().availableProcessors ();
5152 final int maxBasedOnNumberOfProcessors ;
53+ final int processorsUsed ;
5254 if (randomBoolean ()) {
5355 final int processors = randomIntBetween (1 , 64 );
5456 maxBasedOnNumberOfProcessors = expectedSize (threadPoolName , processors );
5557 builder .put ("processors" , processors );
58+ processorsUsed = processors ;
5659 } else {
57- maxBasedOnNumberOfProcessors = expectedSize (threadPoolName , Runtime .getRuntime ().availableProcessors ());
60+ maxBasedOnNumberOfProcessors = expectedSize (threadPoolName , availableProcessors );
61+ processorsUsed = availableProcessors ;
5862 }
5963
6064 final int expectedMax ;
@@ -93,6 +97,11 @@ public void testScalingThreadPoolConfiguration() throws InterruptedException {
9397 assertThat (info .getMax (), equalTo (expectedMax ));
9498 assertThat (esThreadPoolExecutor .getMaximumPoolSize (), equalTo (expectedMax ));
9599 });
100+
101+ if (processorsUsed > availableProcessors ) {
102+ assertWarnings ("setting processors to value [" + processorsUsed +
103+ "] which is more than available processors [" + availableProcessors + "] is deprecated" );
104+ }
96105 }
97106
98107 private int expectedSize (final String threadPoolName , final int numberOfProcessors ) {
0 commit comments