Search code examples
javadisruptor-pattern

com.lmax.disruptor.Sequence Duplicate methods


I was looking at the Google Disruptor source, just found an observation:

The following two methods, they both are doing the same operation. One of it is private but it doesn't really answer what's the cause of having duplicate methods.

Is it just for readability of the programmer?

    public void set(final long value)
    {
        unsafe.putOrderedLong(paddedValue, valueOffset, value);
    }

    private void setOrdered(final long value)
    {
        unsafe.putOrderedLong(paddedValue, valueOffset, value);
    }

Solution

  • If your browsing the sources on google code your looking at a rather old build, the official repository is now on GitHub. The current version on github has done away with setOrdered

    As you say the methods are identical so they were either distinctly named for readability or ended up identical due to some refactoring work.