Move flushing logic into HTableConnector.

Also, extract Flusher and ThreadFlusher to top-level.