/** * 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; } }