Don't reschedule a canceled timer

git-svn-id: http://google-refine.googlecode.com/svn/trunk@2236 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Tom Morris 2011-09-13 20:38:34 +00:00
parent 585d3fce3b
commit 131ff81c0d

View File

@ -90,9 +90,11 @@ public class RefineServlet extends Butterfly {
try {
ProjectManager.singleton.save(false); // quick, potentially incomplete save
} finally {
_timer.schedule(new AutoSaveTimerTask(), s_autoSavePeriod);
// we don't use scheduleAtFixedRate because that might result in
// bunched up events when the computer is put in sleep mode
if (_timer != null) {
_timer.schedule(new AutoSaveTimerTask(), s_autoSavePeriod);
// we don't use scheduleAtFixedRate because that might result in
// bunched up events when the computer is put in sleep mode
}
}
}
}