public void close ( ) { closed = true ; while ( appendsInProgress . get ( ) > 0 ) { LOG . info ( "Append is still going on, wait for a while" ) ; try { Thread . sleep ( 100 ) ; } catch ( InterruptedException e ) { LOG . error ( "close is interrupted while appending data is in progress" ) ; } } this . closeComplete . countDown ( ) ; }
When close is invoked all new coming records will be rejected Add a busy loop here to ensure all the ongoing appends are completed