private void incrementSizeAndCount ( E record ) { // Update the count for atomically counted queues. if ( atomicallyCounted ) { count . incrementAndGet ( ) ; } // Update the size for sizeable elements and sizeable queues. if ( sizeable && ( record instanceof Sizeable ) ) { dataSize . addAndGet ( ( ( Sizeable ) record ) . sizeof ( ) ) ; } else if ( sizeable ) { dataSize . incrementAndGet ( ) ; } }
Atomically adds to the size and count if the queue is running in atomic counting mode or sizeable mode and the element is sizeable .