@ Override public synchronized void close ( ) throws BackendException { if ( ! isOpen ) return ; this . isOpen = false ; if ( readExecutor != null ) readExecutor . shutdown ( ) ; if ( sendThread != null ) sendThread . close ( CLOSE_DOWN_WAIT ) ; if ( readExecutor != null ) { try { readExecutor . awaitTermination ( 1 , TimeUnit . SECONDS ) ; } catch ( InterruptedException e ) { log . error ( "Could not terminate reader thread pool for KCVSLog " + name + " due to interruption" ) ; } if ( ! readExecutor . isTerminated ( ) ) { readExecutor . shutdownNow ( ) ; log . error ( "Reader thread pool for KCVSLog " + name + " did not shut down in time - could not clean up or set read markers" ) ; } else { for ( MessagePuller puller : msgPullers ) { puller . close ( ) ; } } } writeSetting ( manager . senderId , MESSAGE_COUNTER_COLUMN , numMsgCounter . get ( ) ) ; store . close ( ) ; manager . closedLog ( this ) ; }
Closes the log by terminating all threads and waiting for their termination .