public class VanillaMessageHistory extends SelfDescribingMarshallable implements MessageHistory
VanillaMessageHistory class is an implementation of MessageHistory that
provides an array-backed history of messages.| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_LENGTH |
static int |
MESSAGE_HISTORY_LENGTH |
EMPTYDISCARD| Constructor and Description |
|---|
VanillaMessageHistory() |
| Modifier and Type | Method and Description |
|---|---|
void |
addSource(int id,
long index)
Adds a new source with the given ID and index to the message history.
|
boolean |
addSourceDetails()
Gets the flag that determines whether the MessageHistory should automatically
add a timestamp on read.
|
void |
addSourceDetails(boolean addSourceDetails)
Sets whether the MessageHistory should automatically add a timestamp on read.
|
void |
addTiming(long l)
Adds a timing value to the message history.
|
net.openhft.chronicle.bytes.util.BinaryLengthLength |
binaryLengthLength()
Provides an assumed length in bytes for the serialized form of this entity.
|
<T> T |
deepCopy()
Override deepCopy as writeMarshallable adds a timing every time it is called.
|
void |
doWriteHistory(DocumentContext dc) |
boolean |
equals(Object o) |
int |
hashCode() |
void |
historyWallClock(boolean historyWallClock) |
boolean |
isDirty() |
int |
lastSourceId()
Returns the last source id contained in this
MessageHistory. |
long |
lastSourceIndex()
Returns the last source index contained in this
MessageHistory. |
protected long |
nanoTime()
Returns the current time in nanoseconds.
|
void |
readMarshallable(@NotNull net.openhft.chronicle.bytes.BytesIn<?> bytes)
Reads the message history data from the provided bytes input.
|
void |
readMarshallable(@NotNull WireIn wire)
Reads the state of the Marshallable object from the given wire input.
|
void |
reset()
Clears all data contained in this
MessageHistory |
void |
reset(int sourceId,
long sourceIndex)
Resets the
MessageHistory with the provided sourceId
and sourceIndex as a starting point. |
int |
sourceId(int n)
Returns the source id at a position specified by the input
n. |
boolean |
sourceIdsEndsWith(int[] sourceIds)
Returns
true if the source ids contained in this
MessageHistory end with the provided sourceIds. |
long |
sourceIndex(int n)
Returns the index of the source at a position specified by the
input
n. |
int |
sources()
Returns the number of sources contained in this
MessageHistory. |
long |
timing(int n)
Returns a timing at a position specified by the input
n. |
int |
timings()
Returns the number of timings contained in this
MessageHistory. |
String |
toString()
We need a custom toString as the base class toString calls writeMarshallable which does not mutate this,
but will display a different result every time you toString the object as it outputs System.nanoTime
or Wall Clock in NS if the wall.clock.message.history system property is set
|
void |
useBytesMarshallable(boolean useBytesMarshallable) |
void |
writeMarshallable(@NotNull net.openhft.chronicle.bytes.BytesOut<?> b) |
void |
writeMarshallable(@NotNull WireOut wire)
Writes the state of the Marshallable object to the given wire output.
|
void |
writeMarshallable0(@NotNull net.openhft.chronicle.bytes.BytesOut<?> b) |
usesSelfDescribingMessageclone, finalize, getClass, notify, notifyAll, wait, wait, waitclear, emptyHistory, get, set, writeHistory$equals, $fieldInfoMap, $fieldInfos, $hashCode, $toString, className, copyTo, fromFile, fromFile, fromString, fromString, fromString, getField, getLongField, mergeToMap, setField, setLongField, streamFromFile, streamFromFilewriteValueunexpectedFieldpublic static final int MESSAGE_HISTORY_LENGTH
public static final int MAX_LENGTH
public void addSourceDetails(boolean addSourceDetails)
addSourceDetails - True if source details should be added, false otherwise.public void reset()
MessageHistoryMessageHistoryreset in interface net.openhft.chronicle.core.io.Resettablereset in interface Marshallablereset in interface MessageHistorypublic boolean addSourceDetails()
public void reset(int sourceId,
long sourceIndex)
MessageHistoryMessageHistory with the provided sourceId
and sourceIndex as a starting point.reset in interface MessageHistorypublic int lastSourceId()
MessageHistoryMessageHistory.lastSourceId in interface MessageHistoryMessageHistory.public long lastSourceIndex()
MessageHistoryMessageHistory.lastSourceIndex in interface MessageHistoryMessageHistory.public int timings()
MessageHistoryMessageHistory.timings in interface MessageHistoryMessageHistory.public long timing(int n)
MessageHistoryn.timing in interface MessageHistoryn.public int sources()
MessageHistoryMessageHistory.sources in interface MessageHistoryMessageHistory.public int sourceId(int n)
MessageHistoryn.sourceId in interface MessageHistoryn.public boolean sourceIdsEndsWith(int[] sourceIds)
MessageHistorytrue if the source ids contained in this
MessageHistory end with the provided sourceIds.sourceIdsEndsWith in interface MessageHistorytrue if the source ids contained in this
MessageHistory end with the provided sourceIds.public long sourceIndex(int n)
MessageHistoryn.sourceIndex in interface MessageHistoryn.public void readMarshallable(@NotNull
@NotNull WireIn wire)
throws net.openhft.chronicle.core.io.IORuntimeException,
net.openhft.chronicle.core.io.InvalidMarshallableException
MarshallableThe default implementation will use a default value for each field not present
readMarshallable in interface MarshallablereadMarshallable in interface ReadMarshallablewire - The wire input source.net.openhft.chronicle.core.io.IORuntimeException - If an IO error occurs during the read operation.net.openhft.chronicle.core.io.InvalidMarshallableException - If there's an error during marshalling.public void writeMarshallable(@NotNull
@NotNull WireOut wire)
MarshallableThe default implementation will write all values even if they are a default value. c.f. readMarshallable
writeMarshallable in interface MarshallablewriteMarshallable in interface WriteMarshallablewire - The wire output destination.public void readMarshallable(@NotNull
@NotNull net.openhft.chronicle.bytes.BytesIn<?> bytes)
throws net.openhft.chronicle.core.io.IORuntimeException
readMarshallable in interface net.openhft.chronicle.bytes.BytesMarshallablereadMarshallable in interface net.openhft.chronicle.bytes.ReadBytesMarshallablebytes - Input bytes to read the data from.net.openhft.chronicle.core.io.IORuntimeExceptionpublic void writeMarshallable(@NotNull
@NotNull net.openhft.chronicle.bytes.BytesOut<?> b)
writeMarshallable in interface net.openhft.chronicle.bytes.BytesMarshallablewriteMarshallable in interface net.openhft.chronicle.bytes.WriteBytesMarshallablepublic void writeMarshallable0(@NotNull
@NotNull net.openhft.chronicle.bytes.BytesOut<?> b)
protected long nanoTime()
public void addSource(int id,
long index)
id - The ID of the source.index - The index of the source.public boolean isDirty()
isDirty in interface MessageHistorytrue if the message history has not been written using
Marshallable.writeMarshallable(net.openhft.chronicle.wire.WireOut)public void addTiming(long l)
l - The timing value to be added.public String toString()
@NotNull
public <T> T deepCopy()
throws net.openhft.chronicle.core.io.InvalidMarshallableException
toString()deepCopy in interface Marshallablenet.openhft.chronicle.core.io.InvalidMarshallableExceptionpublic net.openhft.chronicle.bytes.util.BinaryLengthLength binaryLengthLength()
WriteMarshallablebinaryLengthLength in interface WriteMarshallablepublic void doWriteHistory(DocumentContext dc)
doWriteHistory in interface MessageHistorypublic void useBytesMarshallable(boolean useBytesMarshallable)
public void historyWallClock(boolean historyWallClock)
Copyright © 2024. All rights reserved.