Avoid potential refresh deadlock with AbstractApplicationContext#registerShutdownHook (original) (raw)

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.