public synchronized boolean resume() { if (timer == null) { return false; } stateSync.lock(); try { startTask(); } finally { stateSync.unlock(); } return true; }
public synchronized boolean start() { if (timer != null) { return false; } stateSync.lock(); try { timer = new Timer(); startTask(); } finally { stateSync.unlock(); } return true; }