/** * 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. */ 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); }
labelLength += tempBuffer.putLongAscii(labelOffset + labelLength, registrationId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putIntAscii(labelOffset + labelLength, sessionId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putIntAscii(labelOffset + labelLength, streamId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putStringWithoutLengthAscii(
labelLength += tempBuffer.putLongAscii(labelOffset + labelLength, registrationId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putIntAscii(labelOffset + labelLength, sessionId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putIntAscii(labelOffset + labelLength, streamId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putStringWithoutLengthAscii(
/** * 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. */ 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); }
labelLength += tempBuffer.putLongAscii(labelOffset + labelLength, registrationId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putIntAscii(labelOffset + labelLength, sessionId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putIntAscii(labelOffset + labelLength, streamId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putStringWithoutLengthAscii(
labelLength += tempBuffer.putLongAscii(labelOffset + labelLength, registrationId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putIntAscii(labelOffset + labelLength, sessionId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putIntAscii(labelOffset + labelLength, streamId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putStringWithoutLengthAscii(
labelLength += tempBuffer.putLongAscii(labelOffset + labelLength, registrationId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putIntAscii(labelOffset + labelLength, sessionId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putIntAscii(labelOffset + labelLength, streamId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putStringWithoutLengthAscii(
labelLength += tempBuffer.putLongAscii(labelOffset + labelLength, registrationId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putIntAscii(labelOffset + labelLength, sessionId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putIntAscii(labelOffset + labelLength, streamId); labelLength += tempBuffer.putStringWithoutLengthAscii(labelOffset + labelLength, " "); labelLength += tempBuffer.putStringWithoutLengthAscii(