private boolean acquireWriteFuture ( int sliceLength ) { if ( sliceLength > 0 ) { Object writeResult = null ; // determine a good timeout value based on the slice length to write int timeout = sliceLength * 500 ; // check for existing future if ( writerFuture != null ) { try { // wait for a result from the last writer writeResult = writerFuture . get ( timeout , TimeUnit . MILLISECONDS ) ; } catch ( Exception e ) { log . warn ( "Exception waiting for write result. Timeout: {}ms" , timeout , e ) ; return false ; } } log . debug ( "Write future result (expect null): {}" , writeResult ) ; return true ; } return false ; }
Get the WriteFuture with a timeout based on the length of the slice to write .