本文整理了Java中io.aeron.logbuffer.Header.termId()
方法的一些代码示例,展示了Header.termId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header.termId()
方法的具体详情如下:
包路径:io.aeron.logbuffer.Header
类名称:Header
方法名:termId
[英]The term ID to which the frame belongs.
[中]框架所属的术语ID。
代码示例来源:origin: real-logic/aeron
/**
* Return a reusable, parameterized {@link FragmentHandler} that prints to stdout for the first stream(STREAM)
*
* @param streamId to show when printing
* @return subscription data handler function that prints the message contents
*/
public static FragmentHandler reassembledStringMessage1(final int streamId)
{
return (buffer, offset, length, header) ->
{
final byte[] data = new byte[length];
buffer.getBytes(offset, data);
System.out.format(
"message to stream %d from session %x term id %x term offset %d (%d@%d)%n",
streamId, header.sessionId(), header.termId(), header.termOffset(), length, offset);
if (length != 10000)
{
System.out.format(
"Received message was not assembled properly;" +
" received length was %d, but was expecting 10000%n",
length);
}
};
}
代码示例来源:origin: real-logic/aeron
/**
* Return a reusable, parameterised {@link FragmentHandler} that prints to stdout for the second stream (STREAM + 1)
*
* @param streamId to show when printing
* @return subscription data handler function that prints the message contents
*/
public static FragmentHandler reassembledStringMessage2(final int streamId)
{
return (buffer, offset, length, header) ->
{
final byte[] data = new byte[length];
buffer.getBytes(offset, data);
System.out.format(
"message to stream %d from session %x term id %x term offset %d (%d@%d)%n",
streamId, header.sessionId(), header.termId(), header.termOffset(), length, offset);
if (length != 9000)
{
System.out.format(
"Received message was not assembled properly; received length was %d, but was expecting 9000%n",
length);
}
};
}
}
代码示例来源:origin: real-logic/aeron
/**
* Get the current position to which the image has advanced on reading this message.
*
* @return the current position to which the image has advanced on reading this message.
*/
public final long position()
{
final int resultingOffset = BitUtil.align(termOffset() + frameLength(), FRAME_ALIGNMENT);
return computePosition(termId(), resultingOffset, positionBitsToShift, initialTermId);
}
代码示例来源:origin: real-logic/aeron
"Received message (%s) to stream %d from session %x term id %x term offset %d (%d@%d)",
new String(data), streamId, header.sessionId(),
header.termId(), header.termOffset(), length, offset));
代码示例来源:origin: real-logic/aeron
assertThat(header.termId(), is(ACTIVE_TERM_ID));
assertThat(header.streamId(), is(STREAM_ID));
assertThat(header.sessionId(), is(SESSION_ID));
代码示例来源:origin: real-logic/aeron
assertThat(header.termId(), is(ACTIVE_TERM_ID));
assertThat(header.streamId(), is(STREAM_ID));
assertThat(header.sessionId(), is(SESSION_ID));
代码示例来源:origin: real-logic/aeron
assertThat(header.termId(), is(ACTIVE_TERM_ID));
assertThat(header.streamId(), is(STREAM_ID));
assertThat(header.sessionId(), is(SESSION_ID));
代码示例来源:origin: real-logic/aeron
assertThat(header.termId(), is(ACTIVE_TERM_ID));
assertThat(header.streamId(), is(STREAM_ID));
assertThat(header.sessionId(), is(SESSION_ID));
代码示例来源:origin: io.aeron/aeron-client
/**
* Get the current position to which the image has advanced on reading this message.
*
* @return the current position to which the image has advanced on reading this message.
*/
public final long position()
{
final int resultingOffset = BitUtil.align(termOffset() + frameLength(), FRAME_ALIGNMENT);
return computePosition(termId(), resultingOffset, positionBitsToShift, initialTermId);
}
代码示例来源:origin: io.aeron/aeron-all
/**
* Get the current position to which the image has advanced on reading this message.
*
* @return the current position to which the image has advanced on reading this message.
*/
public final long position()
{
final int resultingOffset = BitUtil.align(termOffset() + frameLength(), FRAME_ALIGNMENT);
return computePosition(termId(), resultingOffset, positionBitsToShift, initialTermId);
}
内容来源于网络,如有侵权,请联系作者删除!