Class ServerProtocolIO
java.lang.Object
org.apache.tika.pipes.core.server.ServerProtocolIO
Centralizes protocol I/O operations shared by
PipesServer and
ConnectionHandler.
This class handles the pure protocol mechanics — serialization, framing, and ACK exchange. It does not make lifecycle decisions (exit vs. return, close connection vs. shut down JVM). Callers are responsible for catching exceptions and responding according to their own lifecycle policy.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidawaitAck()Reads a framed message and verifies it is an ACK.static voidvalidateFetchEmitTuple(FetchEmitTuple fetchEmitTuple) Validates that a FetchEmitTuple's configuration is consistent.voidwriteCrash(PipesMessageType crashType, Throwable t) Writes a crash message (OOM, TIMEOUT, or UNSPECIFIED_CRASH) with the serialized stack trace and waits for ACK.voidwriteFinished(PipesResult pipesResult) Writes a FINISHED message with the serialized result and waits for ACK.voidwriteIntermediate(Metadata metadata) Writes an INTERMEDIATE_RESULT message with the serialized metadata and waits for ACK.
-
Constructor Details
-
ServerProtocolIO
-
-
Method Details
-
writeFinished
Writes a FINISHED message with the serialized result and waits for ACK.- Throws:
ShutDownReceivedException- if SHUT_DOWN is received instead of ACKIOException- on serialization or I/O errors
-
writeIntermediate
Writes an INTERMEDIATE_RESULT message with the serialized metadata and waits for ACK.- Throws:
ShutDownReceivedException- if SHUT_DOWN is received instead of ACKIOException- on serialization or I/O errors
-
writeCrash
Writes a crash message (OOM, TIMEOUT, or UNSPECIFIED_CRASH) with the serialized stack trace and waits for ACK.- Throws:
IOException- on serialization, I/O, or unexpected ACK response
-
awaitAck
Reads a framed message and verifies it is an ACK.- Throws:
ShutDownReceivedException- if the message is SHUT_DOWNIOException- if the message is any other non-ACK type, or on I/O error
-
validateFetchEmitTuple
Validates that a FetchEmitTuple's configuration is consistent.If the tuple has an UnpackConfig with an emitter but ParseMode is not UNPACK, that's a configuration error.
- Throws:
TikaConfigException
-