RED-36660 Switched to using a volatile variable