[JENKINS-24763] Prevent thread starvation by skipping old data removal onSave/remove if doDiscard is running.


Previous impl did this check after obtaining the synchronization lock, which is pointless. Also, previous flag was not thread safe.