public long offer(
        final DirectBuffer buffer,
        final int offset,
        final int length,
        final ReservedValueSupplier reservedValueSupplier)
    {
        long newPosition = CLOSED;
        if (!isClosed)
        {
            final long limit = positionLimit.getVolatile();
            final int termCount = activeTermCount(logMetaDataBuffer);
            final TermAppender termAppender = termAppenders[indexByTermCount(termCount)];
            final long rawTail = termAppender.rawTailVolatile();
            final long termOffset = rawTail & 0xFFFF_FFFFL;
            final int termId = termId(rawTail);
            final long position = computeTermBeginPosition(termId, positionBitsToShift, initialTermId) + termOffset;

            if (termCount != (termId - initialTermId))
            {
                return ADMIN_ACTION;
            }

            if (position < limit)
            {
                final int resultingOffset;
                if (length <= maxPayloadLength)
                {
                    checkPositiveLength(length);
                    resultingOffset = termAppender.appendUnfragmentedMessage(
                        headerWriter, buffer, offset, length, reservedValueSupplier, termId);
                }
                else
                {
                    checkMaxMessageLength(length);
                    resultingOffset = termAppender.appendFragmentedMessage(
                        headerWriter, buffer, offset, length, maxPayloadLength, reservedValueSupplier, termId);
                }

                newPosition = newPosition(termCount, (int)termOffset, termId, position, resultingOffset);
            }
            else
            {
                newPosition = backPressureStatus(position, length);
            }
        }

        return newPosition;
    }
public long offer ( final DirectBuffer buffer , final int offset , final int length , final ReservedValueSupplier reservedValueSupplier ) { long newPosition = CLOSED ; if ( ! isClosed ) { final long limit = positionLimit . getVolatile ( ) ; final int termCount = activeTermCount ( logMetaDataBuffer ) ; final TermAppender termAppender = termAppenders [ indexByTermCount ( termCount ) ] ; final long rawTail = termAppender . rawTailVolatile ( ) ; final long termOffset = rawTail & 0xFFFF_FFFFL ; final int termId = termId ( rawTail ) ; final long position = computeTermBeginPosition ( termId , positionBitsToShift , initialTermId ) + termOffset ; if ( termCount != ( termId - initialTermId ) ) { return ADMIN_ACTION ; } if ( position < limit ) { final int resultingOffset ; if ( length <= maxPayloadLength ) { checkPositiveLength ( length ) ; resultingOffset = termAppender . appendUnfragmentedMessage ( headerWriter , buffer , offset , length , reservedValueSupplier , termId ) ; } else { checkMaxMessageLength ( length ) ; resultingOffset = termAppender . appendFragmentedMessage ( headerWriter , buffer , offset , length , maxPayloadLength , reservedValueSupplier , termId ) ; } newPosition = newPosition ( termCount , ( int ) termOffset , termId , position , resultingOffset ) ; } else { newPosition = backPressureStatus ( position , length ) ; } } return newPosition ; }
Non-blocking publish of a partial buffer containing a message.

@param buffer                containing message.
@param offset                offset in the buffer at which the encoded message begins.
@param length                in bytes of the encoded message.
@param reservedValueSupplier {@link ReservedValueSupplier} for the frame.
@return The new stream position, otherwise a negative error value of {@link #NOT_CONNECTED},
{@link #BACK_PRESSURED}, {@link #ADMIN_ACTION}, {@link #CLOSED}, or {@link #MAX_POSITION_EXCEEDED}.