core/src/main/java/com/orientechnologies/common/collection/closabledictionary/OClosableLinkedContainer.java
private long putEntryInReadBuffer(OClosableEntry<K, V> entry, int bufferIndex) {
    //next index to write for this buffer
    AtomicLong writeCounter = readBufferWriteCount[bufferIndex];
    final long counter = writeCounter.get();

    //we do not use CAS operations to limit contention between threads
    //it is normal that because of duplications of indexes some of items will be lost
    writeCounter.lazySet(counter + 1);

    final AtomicReference<OClosableEntry<K, V>>[] buffer = readBuffers[bufferIndex];
    AtomicReference<OClosableEntry<K, V>> bufferEntry = buffer[(int) (counter & READ_BUFFER_INDEX_MASK)];
    bufferEntry.lazySet(entry);

    return counter + 1;
  }
private long putEntryInReadBuffer(OClosableEntry<K, V> entry, int bufferIndex) {
    //next index to write for this buffer
    AtomicLong writeCounter = readBufferWriteCount[bufferIndex];
    final long counter = writeCounter.get();

    //we do not use CAS operations to limit contention between threads
    //it is normal that because of duplications of indexes some of items will be lost
    writeCounter.lazySet(counter + 1);

    final AtomicReference<OClosableEntry<K, V>>[] buffer = readBuffers[bufferIndex];
    AtomicReference<OClosableEntry<K, V>> bufferEntry = buffer[(int) (counter & READ_BUFFER_INDEX_MASK)];
    bufferEntry.lazySet(entry);

    return counter + 1;
  }
Adds entry to the read buffer with selected index and returns amount of writes to this buffer since creation of this container.

@param entry       LRU entry to add.
@param bufferIndex Index of buffer

@return Amount of writes to the buffer since creation of this container.