Originally reported in #29692.

Courtesy of @wilkinsona, looking at the original PR:

It looks to me like a better fix could be to only synchronize on startupShutdownMonitor while closed and active are being read or written so that those reads and writes are atomic.

Comment From: wilkinsona

These changes have broken this Spring Boot test.

Edit: I think I can modify the test to adapt to the change in the locking model with no adverse affects on the runtime behavior.