This ensures that the calls to setExtendedState are thread safe as that is probably what was causing the occasional game crash before.