Checkstyle warning fix: The shutdown function is too complex