public abstract class AbstractGeneratedMethodReader extends Object implements net.openhft.chronicle.bytes.MethodReader
Common machinery for method readers generated by GenerateMethodReader.
Subclasses implement readOneGenerated(WireIn) and
readOneMetaGenerated(WireIn) with optimised dispatch logic.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
dataEventProcessed |
protected WireParselet |
debugLoggingParselet |
protected MessageHistory |
messageHistory |
static ThreadLocal<String> |
SERVICE_NAME |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractGeneratedMethodReader(MarshallableIn in,
WireParselet debugLoggingParselet)
Creates a reader for the supplied input.
|
| Modifier and Type | Method and Description |
|---|---|
protected Object |
actualInvoke(Method method,
Object o,
Object[] objects)
Invokes a given method on the provided object with the specified arguments.
|
protected <T> T |
checkRecycle(T o)
Offers a workaround to selectively disable "object recycling read" provided by
ValueIn.object(Object, Class)
for specific object types. |
void |
close()
Closes this reader and optionally the underlying
MarshallableIn. |
net.openhft.chronicle.bytes.MethodReader |
closeIn(boolean closeIn)
Controls whether the underlying input is closed when this reader closes.
|
void |
historyConsumer(Consumer<MessageHistory> historyConsumer)
Sets a
Consumer that receives MessageHistory objects. |
boolean |
isClosed()
Indicates whether
close() has been called. |
protected static Method |
lookupMethod(Class<?> clazz,
String name,
Class<?>... parameterTypes)
A utility method that assists implementations in retrieving a method from a class.
|
net.openhft.chronicle.bytes.MethodReaderInterceptorReturns |
methodReaderInterceptorReturns()
Returns
null unless overridden by generated readers that support
interceptors. |
AbstractGeneratedMethodReader |
predicate(Predicate<net.openhft.chronicle.bytes.MethodReader> predicate)
Sets a predicate that
readOne() will evaluate. |
boolean |
readOne()
Reads and dispatches a single message.
|
MethodReaderStatus |
readOne0(DocumentContext context)
Core logic for reading a single document.
|
protected abstract MethodReaderStatus |
readOneGenerated(WireIn wireIn)
Dispatches a data event read from
wireIn. |
protected abstract MethodReaderStatus |
readOneMetaGenerated(WireIn wireIn)
As
readOneGenerated(WireIn) but for metadata events. |
protected boolean |
restIgnored()
Hook for generated code to skip the remainder of a message when method
chaining returns an
IgnoresEverything
instance. |
void |
scanning(boolean scanning)
Sets whether this reader is in scanning mode.
|
void |
throwExceptionIfClosed()
Checks if the method reader instance has been closed and throws a
ClosedIllegalStateException if it is. |
public static final ThreadLocal<String> SERVICE_NAME
protected final WireParselet debugLoggingParselet
protected MessageHistory messageHistory
protected boolean dataEventProcessed
protected AbstractGeneratedMethodReader(MarshallableIn in, WireParselet debugLoggingParselet)
SERVICE_NAME is set
the value is used to obtain a temporary history cache from
TEMP_MESSAGE_HISTORY_BY_SERVICE_NAME so that services sharing a
thread keep separate histories.in - input providing documentsdebugLoggingParselet - parselet used when debug logging is enabledpublic AbstractGeneratedMethodReader predicate(Predicate<net.openhft.chronicle.bytes.MethodReader> predicate)
readOne() will evaluate. If the predicate
returns false, no attempt is made to read a message.predicate - condition to be evaluated before readingprotected static Method lookupMethod(Class<?> clazz, String name, Class<?>... parameterTypes)
clazz - The class containing the methodname - The name of the methodparameterTypes - The parameter types of the methodpublic void historyConsumer(Consumer<MessageHistory> historyConsumer)
Consumer that receives MessageHistory objects. The
consumer is called from readOne0(DocumentContext) when a cached
history must be written because the next message originates from another
source.historyConsumer - recipient of unwritten message historyprotected abstract MethodReaderStatus readOneGenerated(WireIn wireIn)
wireIn.
Implementations generated by GenerateMethodReader parse the event
name, deserialize arguments and invoke the corresponding handler method.wireIn - input wireprotected abstract MethodReaderStatus readOneMetaGenerated(WireIn wireIn)
readOneGenerated(WireIn) but for metadata events.public MethodReaderStatus readOne0(DocumentContext context)
The method resets messageHistory with the current source and index,
optionally writes any pending history via historyConsumer and then
processes all data in the document using readOneGenerated(WireIn) or
readOneMetaGenerated(WireIn) depending on DocumentContext.isData().
When the document contains a data event and history propagation is enabled
the method may swap the history buffers using swapMessageHistoryIfDirty().
context - the document context being readprotected boolean restIgnored()
IgnoresEverything
instance. The default implementation never skips.true if the rest of the message should be ignoredpublic boolean readOne()
predicate and in scanning mode continues
looping until a matching message is found or no document is present.readOne in interface net.openhft.chronicle.bytes.MethodReaderpublic void throwExceptionIfClosed()
throws net.openhft.chronicle.core.io.ClosedIllegalStateException
ClosedIllegalStateException if it is.
This method is intended to guard against operations on a closed instance, ensuring that no further
operations can be performed once the instance has been closed. This is particularly useful for
methods that modify the state of the instance or rely on its open state to function correctly.net.openhft.chronicle.core.io.ClosedIllegalStateException - if this instance has already been closed.public net.openhft.chronicle.bytes.MethodReaderInterceptorReturns methodReaderInterceptorReturns()
null unless overridden by generated readers that support
interceptors.methodReaderInterceptorReturns in interface net.openhft.chronicle.bytes.MethodReaderpublic void close()
MarshallableIn.close in interface Closeableclose in interface AutoCloseablepublic boolean isClosed()
close() has been called.isClosed in interface net.openhft.chronicle.core.io.QueryCloseablepublic net.openhft.chronicle.bytes.MethodReader closeIn(boolean closeIn)
closeIn in interface net.openhft.chronicle.bytes.MethodReaderprotected <T> T checkRecycle(T o)
ValueIn.object(Object, Class)
for specific object types. This ensures that certain objects, such as arrays and collections, are
not unintentionally reused or recycled during the reading process.T - The generic type of the object to check.o - The object instance to verify and possibly recycle.null if the object is either
null or an array. If the object is a collection or map, the method will clear its
content and return the object.protected Object actualInvoke(Method method, Object o, Object[] objects)
method - The method to be invoked.o - The target object on which the method is to be invoked.objects - The arguments to the method.RuntimeException - if the method invocation throws an exception.public void scanning(boolean scanning)
Copyright © 2026 Chronicle Software Ltd. All rights reserved.