### Question:
DynamicTaskExecutor implements TaskExecutor<LOCAL> { @Override public int processors( int delta ) { if ( shutDown || delta == 0 ) { return processors.length; } synchronized ( this ) { if ( shutDown ) { return processors.length; } int requestedNumber = processors.length + delta; if ( delta > 0 ) { requestedNumber = min( requestedNumber, maxProcessorCount ); if ( requestedNumber > processors.length ) { Processor[] newProcessors = Arrays.copyOf( processors, requestedNumber ); for ( int i = processors.length; i < requestedNumber; i++ ) { newProcessors[i] = new Processor( processorThreadNamePrefix + "-" + i ); } this.processors = newProcessors; } } else { requestedNumber = max( 1, requestedNumber ); if ( requestedNumber < processors.length ) { Processor[] newProcessors = Arrays.copyOf( processors, requestedNumber ); for ( int i = newProcessors.length; i < processors.length; i++ ) { processors[i].processorShutDown = true; } this.processors = newProcessors; } } return processors.length; } } DynamicTaskExecutor( int initialProcessorCount, int maxProcessorCount, int maxQueueSize,
            ParkStrategy parkStrategy, String processorThreadNamePrefix );  DynamicTaskExecutor( int initialProcessorCount, int maxProcessorCount, int maxQueueSize,
            ParkStrategy parkStrategy, String processorThreadNamePrefix, Supplier<LOCAL> initialLocalState ); @Override int processors( int delta ); @Override void submit( Task<LOCAL> task ); @Override void assertHealthy(); @Override void receivePanic( Throwable cause ); @Override synchronized void close();  }### Answer:
@Repeat( times = 10 ) @Test public void shouldCopeWithConcurrentIncrementOfProcessorsAndShutdown() throws Throwable { TaskExecutor<Void> executor = new DynamicTaskExecutor<>( 1, 2, 2, PARK, "test" ); Race race = new Race().withRandomStartDelays(); race.addContestant( executor::close ); race.addContestant( () -> executor.processors( 1 ) ); race.go( 10, SECONDS ); }