public static long calculateDelta ( long reportedHandledCount , long lastKnownHandledCount ) { if ( lastKnownHandledCount > reportedHandledCount ) { throw new IllegalStateException ( "Illegal Stream Management State: Last known handled count (" + lastKnownHandledCount + ") is greater than reported handled count (" + reportedHandledCount + ' ' ) ; } return ( reportedHandledCount - lastKnownHandledCount ) & MASK_32_BIT ; }
Calculates the delta of the last known stanza handled count and the new reported stanza handled count while considering that the new value may be wrapped after 2^32 - 1 .