public interface FlightServerMiddleware
Middleware are instantiated per-call.
Methods are not guaranteed to be called on any particular thread, relative to the thread that Flight requests are
executed on. Do not depend on thread-local storage; instead, use state on the middleware instance. Service
implementations may communicate with middleware implementations through
org.apache.arrow.flight.FlightProducer.CallContext#getMiddleware(Key). Methods on the middleware instance
are non-reentrant, that is, a particular RPC will not make multiple concurrent calls to methods on a single
middleware instance. However, methods on the factory instance are expected to be thread-safe, and if the factory
instance returns the same middleware object more than once, then that middleware object must be thread-safe.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
FlightServerMiddleware.Factory<T extends FlightServerMiddleware>
A factory for Flight server middleware.
|
static class |
FlightServerMiddleware.Key<T extends FlightServerMiddleware>
A key for Flight server middleware.
|
| Modifier and Type | Method and Description |
|---|---|
void |
onBeforeSendingHeaders(CallHeaders outgoingHeaders)
Callback for when the underlying transport is about to send response headers.
|
void |
onCallCompleted(CallStatus status)
Callback for when the underlying transport has completed a call.
|
void |
onCallErrored(Throwable err)
Callback for when an RPC method implementation throws an uncaught exception.
|
void onBeforeSendingHeaders(CallHeaders outgoingHeaders)
outgoingHeaders - A mutable set of response headers. These can be manipulated to send different headers to the
client.void onCallCompleted(CallStatus status)
status - Whether the call completed successfully or not.void onCallErrored(Throwable err)
May be called multiple times, and may be called before or after onCallCompleted(CallStatus).
Generally, an uncaught exception will end the call with a error CallStatus, and will be reported to onCallCompleted(CallStatus), but not necessarily this method.
err - The exception that was thrown.Copyright © 2024 The Apache Software Foundation. All rights reserved.