use of net.openhft.chronicle.wire.ValueOut in project Chronicle-Queue by OpenHFT.
the class QueueInspectorTest method shouldDetermineWritingProcessIdWhenDocumentIsNotComplete.
@Test
public void shouldDetermineWritingProcessIdWhenDocumentIsNotComplete() throws IOException {
try (final SingleChronicleQueue queue = SingleChronicleQueueBuilder.binary(tmpDir.newFolder()).testBlockSize().build()) {
final QueueInspector inspector = new QueueInspector(queue);
final ExcerptAppender appender = queue.acquireAppender();
appender.writeDocument(37L, ValueOut::int64);
try (final DocumentContext ctx = appender.writingDocument()) {
ctx.wire().write("foo").int32(17L);
final int writingThreadId = inspector.getWritingThreadId();
assertThat(writingThreadId, is(Affinity.getThreadId()));
assertThat(QueueInspector.isValidThreadId(writingThreadId), is(true));
}
}
}
Aggregations