public static Counter allocate(
        final Aeron aeron,
        final MutableDirectBuffer tempBuffer,
        final int serviceId)
    {
        tempBuffer.putInt(SERVICE_ID_OFFSET, serviceId);

        final int labelOffset = BitUtil.align(KEY_LENGTH, SIZE_OF_INT);
        int labelLength = 0;
        labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, NAME);
        labelLength += tempBuffer.putIntAscii(labelOffset + labelLength, serviceId);

        return aeron.addCounter(
            SERVICE_HEARTBEAT_TYPE_ID, tempBuffer, 0, KEY_LENGTH, tempBuffer, labelOffset, labelLength);
    }
public static Counter allocate(
        final Aeron aeron,
        final MutableDirectBuffer tempBuffer,
        final int serviceId)
    {
        tempBuffer.putInt(SERVICE_ID_OFFSET, serviceId);

        final int labelOffset = BitUtil.align(KEY_LENGTH, SIZE_OF_INT);
        int labelLength = 0;
        labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, NAME);
        labelLength += tempBuffer.putIntAscii(labelOffset + labelLength, serviceId);

        return aeron.addCounter(
            SERVICE_HEARTBEAT_TYPE_ID, tempBuffer, 0, KEY_LENGTH, tempBuffer, labelOffset, labelLength);
    }
public static Counter allocate ( final Aeron aeron , final MutableDirectBuffer tempBuffer , final int serviceId ) { tempBuffer . putInt ( SERVICE_ID_OFFSET , serviceId ) ; final int labelOffset = BitUtil . align ( KEY_LENGTH , SIZE_OF_INT ) ; int labelLength = 0 ; labelLength += tempBuffer . putStringWithoutLengthAscii ( labelOffset + labelLength , NAME ) ; labelLength += tempBuffer . putIntAscii ( labelOffset + labelLength , serviceId ) ; return aeron . addCounter ( SERVICE_HEARTBEAT_TYPE_ID , tempBuffer , 0 , KEY_LENGTH , tempBuffer , labelOffset , labelLength ) ; }
Allocate a counter to represent the heartbeat of a clustered service.

@param aeron           to allocate the counter.
@param tempBuffer      to use for building the key and label without allocation.
@param serviceId       of the service heartbeat.
@return the {@link Counter} for the commit position.
Allocate a counter to represent the heartbeat of a clustered service .