The effect on multi-jet recording of RingBuffer is negligible, but can be significant under very heavy loads.
The RingBuffer implementation contains a nextnode where the following addition will be added. If only one stream is written to the ring, the process will always be completed in the shortest time, i.e. buffer[head++] = newData.
, , - while ( !buffer[head++].compareAndSet(null,newValue)){}. , , .
, , getFree .
private Node<T> getFree() {
Node<T> freeNode = head.get();
int skipped = 0;
while (skipped < capacity && !freeNode.free.compareAndSet(true, false)) {
skipped += 1;
freeNode = freeNode.next;
}
}