/** Stops this store service. */ public void stop() throws IOException { ResettableTimer timer = (ResettableTimer) m_timerRef.get(); if (timer != null) { if (!timer.isShutDown()) { // Shutdown and await termination... timer.shutDown(); } // Clear reference... m_timerRef.compareAndSet(timer, null); } // Write the latest version to disk... flush(); }
/** * Notifies the background timer to schedule a task for storing the contents of this store to * disk. */ private void scheduleTask() { ResettableTimer timer = (ResettableTimer) m_timerRef.get(); if (timer != null && !timer.isShutDown()) { timer.schedule(); } }