/** * Set the Application Specific Feedback for the Status Message. * * @param source of the feedback to set * @param offset of the feedback in the source * @param length of the feedback in bytes * @return flyweight */ public StatusMessageFlyweight applicationSpecificFeedback(final byte[] source, final int offset, final int length) { frameLength(HEADER_LENGTH + length); putBytes(APP_SPECIFIC_FEEDBACK_FIELD_OFFSET, source, offset, length); return this; }
public void onStatusMessage( final StatusMessageFlyweight msg, final UnsafeBuffer buffer, final int length, final InetSocketAddress srcAddress) { if (!controlLossGenerator.shouldDropFrame(srcAddress, msg, msg.frameLength())) { super.onStatusMessage(msg, buffer, length, srcAddress); } }
public String toString() { final StringBuilder sb = new StringBuilder(); final String formattedFlags = String.format("%1$8s", Integer.toBinaryString(flags())).replace(' ', '0'); sb.append("STATUS Message{") .append("frame_length=").append(frameLength()) .append(" version=").append(version()) .append(" flags=").append(formattedFlags) .append(" type=").append(headerType()) .append(" session_id=").append(sessionId()) .append(" stream_id=").append(streamId()) .append(" consumption_term_id=").append(consumptionTermId()) .append(" consumption_term_offset=").append(consumptionTermOffset()) .append(" receiver_window_length=").append(receiverWindowLength()) .append("}"); return sb.toString(); } }
private static void dissect(final StatusMessageFlyweight msg, final StringBuilder builder) { builder .append("SM ") .append(msg.flags()) .append(" len ") .append(msg.frameLength()) .append(' ') .append(msg.sessionId()) .append(':') .append(msg.streamId()) .append(':') .append(msg.consumptionTermId()) .append(" @") .append(msg.consumptionTermOffset()) .append(' ') .append(msg.receiverWindowLength()) .append(' ') .append(msg.receiverId()); }
/** * Retrieve the Application Specific Feedback (if present) from the Status Message. * * @param destination to store the feedback * @return the number of bytes in the feedback copied into the destination */ public int applicationSpecificFeedback(final byte[] destination) { final int frameLength = frameLength(); int result = 0; if (frameLength > HEADER_LENGTH) { if (frameLength > capacity()) { throw new AeronException(String.format( "SM application specific feedback (%d) is truncated (%d)", frameLength - HEADER_LENGTH, capacity() - HEADER_LENGTH)); } final int copyLength = Math.min(destination.length, frameLength - HEADER_LENGTH); getBytes(APP_SPECIFIC_FEEDBACK_FIELD_OFFSET, destination, 0, copyLength); result = copyLength; } return result; }
assertThat(statusHeader.sessionId(), is(SESSION_ID)); assertThat(statusHeader.consumptionTermId(), is(ACTIVE_TERM_ID)); assertThat(statusHeader.frameLength(), is(StatusMessageFlyweight.HEADER_LENGTH));
.headerType(HeaderFlyweight.HDR_TYPE_SM) .frameLength(StatusMessageFlyweight.HEADER_LENGTH); byteBuffer.position(0).limit(statusMessage.frameLength());
/** * Set the Application Specific Feedback for the Status Message. * * @param source of the feedback to set * @param offset of the feedback in the source * @param length of the feedback in bytes * @return flyweight */ public StatusMessageFlyweight applicationSpecificFeedback(final byte[] source, final int offset, final int length) { frameLength(HEADER_LENGTH + length); putBytes(APP_SPECIFIC_FEEDBACK_FIELD_OFFSET, source, offset, length); return this; }
/** * Set the Application Specific Feedback for the Status Message. * * @param source of the feedback to set * @param offset of the feedback in the source * @param length of the feedback in bytes * @return flyweight */ public StatusMessageFlyweight applicationSpecificFeedback(final byte[] source, final int offset, final int length) { frameLength(HEADER_LENGTH + length); putBytes(APP_SPECIFIC_FEEDBACK_FIELD_OFFSET, source, offset, length); return this; }
public void onStatusMessage( final StatusMessageFlyweight msg, final UnsafeBuffer buffer, final int length, final InetSocketAddress srcAddress) { if (!controlLossGenerator.shouldDropFrame(srcAddress, msg, msg.frameLength())) { super.onStatusMessage(msg, buffer, length, srcAddress); } }
public void onStatusMessage( final StatusMessageFlyweight msg, final UnsafeBuffer buffer, final int length, final InetSocketAddress srcAddress) { if (!controlLossGenerator.shouldDropFrame(srcAddress, msg, msg.frameLength())) { super.onStatusMessage(msg, buffer, length, srcAddress); } }
public String toString() { final StringBuilder sb = new StringBuilder(); final String formattedFlags = String.format("%1$8s", Integer.toBinaryString(flags())).replace(' ', '0'); sb.append("STATUS Message{") .append("frame_length=").append(frameLength()) .append(" version=").append(version()) .append(" flags=").append(formattedFlags) .append(" type=").append(headerType()) .append(" session_id=").append(sessionId()) .append(" stream_id=").append(streamId()) .append(" consumption_term_id=").append(consumptionTermId()) .append(" consumption_term_offset=").append(consumptionTermOffset()) .append(" receiver_window_length=").append(receiverWindowLength()) .append("}"); return sb.toString(); } }
public String toString() { final StringBuilder sb = new StringBuilder(); final String formattedFlags = String.format("%1$8s", Integer.toBinaryString(flags())).replace(' ', '0'); sb.append("STATUS Message{") .append("frame_length=").append(frameLength()) .append(" version=").append(version()) .append(" flags=").append(formattedFlags) .append(" type=").append(headerType()) .append(" session_id=").append(sessionId()) .append(" stream_id=").append(streamId()) .append(" consumption_term_id=").append(consumptionTermId()) .append(" consumption_term_offset=").append(consumptionTermOffset()) .append(" receiver_window_length=").append(receiverWindowLength()) .append("}"); return sb.toString(); } }
private static void dissect(final StatusMessageFlyweight msg, final StringBuilder builder) { builder .append("SM ") .append(msg.flags()) .append(" len ") .append(msg.frameLength()) .append(' ') .append(msg.sessionId()) .append(':') .append(msg.streamId()) .append(':') .append(msg.consumptionTermId()) .append(" @") .append(msg.consumptionTermOffset()) .append(' ') .append(msg.receiverWindowLength()) .append(' ') .append(msg.receiverId()); }
/** * Retrieve the Application Specific Feedback (if present) from the Status Message. * * @param destination to store the feedback * @return the number of bytes in the feedback copied into the destination */ public int applicationSpecificFeedback(final byte[] destination) { final int frameLength = frameLength(); int result = 0; if (frameLength > HEADER_LENGTH) { if (frameLength > capacity()) { throw new AeronException(String.format( "SM application specific feedback (%d) is truncated (%d)", frameLength - HEADER_LENGTH, capacity() - HEADER_LENGTH)); } final int copyLength = Math.min(destination.length, frameLength - HEADER_LENGTH); getBytes(APP_SPECIFIC_FEEDBACK_FIELD_OFFSET, destination, 0, copyLength); result = copyLength; } return result; }
/** * Retrieve the Application Specific Feedback (if present) from the Status Message. * * @param destination to store the feedback * @return the number of bytes in the feedback copied into the destination */ public int applicationSpecificFeedback(final byte[] destination) { final int frameLength = frameLength(); int result = 0; if (frameLength > HEADER_LENGTH) { if (frameLength > capacity()) { throw new AeronException(String.format( "SM application specific feedback (%d) is truncated (%d)", frameLength - HEADER_LENGTH, capacity() - HEADER_LENGTH)); } final int copyLength = Math.min(destination.length, frameLength - HEADER_LENGTH); getBytes(APP_SPECIFIC_FEEDBACK_FIELD_OFFSET, destination, 0, copyLength); result = copyLength; } return result; }