@Override public synchronized void stop() throws Exception { if (isStarted()) { try { this.scheduledLiveLock.stop(); this.scheduledBackupLock.stop(); } finally { super.stop(); this.sharedStateManager.close(); this.sharedStateManager = null; this.scheduledLiveLock = null; this.scheduledBackupLock = null; } } }
@Override public void stopBackup() throws Exception { LOGGER.debug("ENTER stopBackup"); try { if (this.scheduledBackupLock.isStarted()) { LOGGER.debug("scheduledBackupLock is running: stop it and release backup lock"); this.scheduledBackupLock.stop(); this.scheduledBackupLock.lock().release(); } else { LOGGER.debug("scheduledBackupLock is not running"); } } finally { LOGGER.debug("EXIT stopBackup"); } }
@Override public void releaseBackup() throws Exception { LOGGER.debug("ENTER releaseBackup"); try { if (this.scheduledBackupLock.isStarted()) { LOGGER.debug("scheduledBackupLock is running: stop it and release backup lock"); this.scheduledBackupLock.stop(); this.scheduledBackupLock.lock().release(); } else { LOGGER.debug("scheduledBackupLock is not running"); } } finally { LOGGER.debug("EXIT releaseBackup"); } }
@Override public void crashLiveServer() throws Exception { LOGGER.debug("ENTER crashLiveServer"); try { if (this.scheduledLiveLock.isStarted()) { LOGGER.debug("scheduledLiveLock is running: request stop it and release live lock"); this.scheduledLiveLock.stop(); this.scheduledLiveLock.lock().release(); } else { LOGGER.debug("scheduledLiveLock is not running"); } } finally { LOGGER.debug("EXIT crashLiveServer"); } }
@Override public void pauseLiveServer() throws Exception { LOGGER.debug("ENTER pauseLiveServer"); try { if (scheduledLiveLock.isStarted()) { LOGGER.debug("scheduledLiveLock is running: set paused shared state, stop it and release live lock"); setPaused(); scheduledLiveLock.stop(); scheduledLiveLock.lock().release(); } else { LOGGER.debug("scheduledLiveLock is not running: try renew live lock"); if (scheduledLiveLock.lock().renew()) { LOGGER.debug("live lock renewed: set paused shared state and release live lock"); setPaused(); scheduledLiveLock.lock().release(); } else { final IllegalStateException e = new IllegalStateException("live lock can't be renewed"); ioCriticalErrorListener.onIOException(e, "live lock can't be renewed on pauseLiveServer", null); throw e; } } } finally { LOGGER.debug("EXIT pauseLiveServer"); } }