long recordRead ( int bufferIndex , Node < K , V > node ) { // The location in the buffer is chosen in a racy fashion as the increment // is not atomic with the insertion. This means that concurrent reads can // overlap and overwrite one another, resulting in a lossy buffer. final AtomicLong counter = readBufferWriteCount [ bufferIndex ] ; final long writeCount = counter . get ( ) ; counter . lazySet ( writeCount + 1 ) ; final int index = ( int ) ( writeCount & READ_BUFFER_INDEX_MASK ) ; readBuffers [ bufferIndex ] [ index ] . lazySet ( node ) ; return writeCount ; }
Records a read in the buffer and return its write count .