private void tryReconcile ( ) { if ( ! this . reconciliationLock . tryLock ( ) ) { return ; } try { reconcile ( ) ; // Keep on warning after every reconcile if nonContiguousMsgIds reaches 500 (kept it a bit higher so that we won't get unnecessary warning due to high concurrency). if ( nonContiguousMsgIds . size ( ) > 500 ) { LOGGER . warn ( "Non - Contiguous Message ID has size : {}, with highestContiguousMsgId as : {}" , nonContiguousMsgIds . size ( ) , highestContiguousMsgId ) ; } } finally { this . reconciliationLock . unlock ( ) ; } }
Try to reconcile if the lock is available otherwise just return as other thread would have hold the lock and performing reconcile .