public interface MethodReader
extends net.openhft.chronicle.core.io.Closeable
A method reader is responsible for reading serialized method calls, typically from a queue or a stream, and then dispatching those method calls to their intended target.
The reader provides a means to intercept method calls and control whether the underlying input should be closed when the reader itself is closed.
This interface extends Closeable
, so any class implementing this interface can also be safely closed.
Modifier and Type | Field and Description |
---|---|
static String |
HISTORY |
static int |
MESSAGE_HISTORY_METHOD_ID |
Modifier and Type | Method and Description |
---|---|
MethodReader |
closeIn(boolean closeIn)
Determines whether the underlying input should be closed when the MethodReader is closed.
|
MethodReaderInterceptorReturns |
methodReaderInterceptorReturns()
Returns a MethodReaderInterceptorReturns instance which can be used to control the flow of method calls.
|
boolean |
readOne()
Attempts to read a single message from the input, if one is available.
|
static final String HISTORY
static final int MESSAGE_HISTORY_METHOD_ID
MethodReaderInterceptorReturns methodReaderInterceptorReturns()
boolean readOne() throws net.openhft.chronicle.core.util.InvocationTargetRuntimeException, IllegalStateException, BufferUnderflowException
If an exception is thrown while dispatching the method call, this should be caught and logged.
If an exception is thrown by the target method itself, this is wrapped in an InvocationTargetRuntimeException
and rethrown.
true
if a message was successfully read, false
if no more messages are availablenet.openhft.chronicle.core.util.InvocationTargetRuntimeException
- If an exception is thrown by the target methodBufferUnderflowException
- If there is not enough data available in the buffer to read the next messagenet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe wayIllegalStateException
MethodReader closeIn(boolean closeIn)
If closeIn
is set to true
, closing the MethodReader will also close the underlying input.
If closeIn
is set to false
, the underlying input will remain open after the MethodReader is closed.
closeIn
- true
to close the input when this reader is closed, false
otherwiseCopyright © 2023. All rights reserved.