private void checkBuffer ( ) { // Doc count limit if ( docBuffer . size ( ) >= bufferDocLimit ) { log . debug ( "=== Buffer check: Doc limit reached '{}'" , docBuffer . size ( ) ) ; submitBuffer ( false ) ; return ; } // Size limit if ( bufferSize > bufferSizeLimit ) { log . debug ( "=== Buffer check: Size exceeded '{}'" , bufferSize ) ; submitBuffer ( false ) ; return ; } // Time limit long age = ( ( new Date ( ) . getTime ( ) ) - bufferOldest ) / 1000 ; if ( age > bufferTimeLimit ) { log . debug ( "=== Buffer check: Age exceeded '{}s'" , age ) ; submitBuffer ( false ) ; return ; } }
Assess the document buffer and decide is it is ready to submit