public void startFlushing(int sleepMS) throws Exception { if (_flusher != null) { try { finishFlushing(); } catch (Exception e) { System.err.println("Error stopping old flusher!!"); e.printStackTrace(); } throw new Exception("Flusher was already running!"); } _flusher = new Flusher(_ri, sleepMS); _flusher.start(); }
/** * Set signal for flusher to finish and wait for it. * * @throws Exception * if the flusher encountered an error any time while it was * running. */ public void finish() throws Exception { _shouldFinish = true; while (isAlive()) { try { Thread.sleep(50); } catch (InterruptedException e) { } } if (_error != null) { throw _error; } }
public void finishFlushing() throws Exception { _flusher.finish(); _ri.flushBuffer(); _flusher = null; }