In LMAX-Exchange/Disruptor 3.4.3, RingBuffer put 7 long padding fields (via extends RingBufferPad) before its really fields
abstract class RingBufferPad
{
protected long p1, p2, p3, p4, p5, p6, p7;
}
and put another 7 long padding fields at the end to avoid false sharing
public final class RingBuffer<E> extends RingBufferFields<E> implements Cursored, EventSequencer<E>, EventSink<E>
{
public static final long INITIAL_CURSOR_VALUE = Sequence.INITIAL_VALUE;
protected long p1, p2, p3, p4, p5, p6, p7;
The question is why putting 7 long padding fields, not 6 fields as described in Mechanical Sympathy - False Sharing.
public final static class VolatileLong
{
public volatile long value = 0L;
public long p1, p2, p3, p4, p5, p6; // comment out
}