[JENKINS-13564] make the method self-correcting
If for some reason the numExecutors field gets out of sync with executors.size() (for example this can happen if an executor swallowed an interrupt signal without properly processing it), then a further attempt to call setNumExecutors(n) results in a no-op. Given that these things can get out of sync, a smarter thing to do is to always compare where we are (the "executors" variable) and where we'd like to be (numExecutors), and make corrective actions. This particularly affects a zombie computer. The sequence to kill a Computer first involves waiting for all the executors to quit. If setNumExecutors(0) becomes no-op, a zombine computer never gets killed.
Loading
Please register or sign in to comment