Module org.elasticsearch.compute
Class BidirectionalBatchExchangeBase
java.lang.Object
org.elasticsearch.compute.operator.exchange.BidirectionalBatchExchangeBase
- All Implemented Interfaces:
Closeable,AutoCloseable,Releasable
- Direct Known Subclasses:
BidirectionalBatchExchangeClient,BidirectionalBatchExchangeServer
Base class for bidirectional batch exchange handlers.
Contains common fields and exchange ID construction logic shared by
BidirectionalBatchExchangeServer and BidirectionalBatchExchangeClient.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ExchangeServiceprotected final Executorprotected final intprotected final Stringprotected final Settingsprotected final Taskprotected final TransportService -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBidirectionalBatchExchangeBase(String sessionId, ExchangeService exchangeService, Executor executor, int maxBufferSize, TransportService transportService, Task task, Settings settings) Base constructor for bidirectional batch exchange handlers. -
Method Summary
Modifier and TypeMethodDescriptionprotected static StringbuildClientToServerId(String sessionId) Constructs the client-to-server exchange ID from the session ID.protected static StringbuildServerToClientId(String sessionId) Constructs the server-to-client exchange ID from the session ID.protected voidconnectRemoteSink(DiscoveryNode node, String exchangeId, ExchangeSourceHandler sourceHandler, ActionListener<Void> listener, String errorMessagePrefix) Connects a remote sink to a source handler via transport.static voidlogExchangeFailure(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level nonCancellationLevel, Exception failure, String message, Object... params) Logs an exchange failure atnonCancellationLevel, unless it is a cancellation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.core.Releasable
close
-
Field Details
-
sessionId
-
exchangeService
-
executor
-
maxBufferSize
protected final int maxBufferSize -
transportService
-
task
-
settings
-
-
Constructor Details
-
BidirectionalBatchExchangeBase
protected BidirectionalBatchExchangeBase(String sessionId, ExchangeService exchangeService, Executor executor, int maxBufferSize, TransportService transportService, Task task, Settings settings) Base constructor for bidirectional batch exchange handlers.- Parameters:
sessionId- the session ID (used for logging and identification)
-
-
Method Details
-
logExchangeFailure
public static void logExchangeFailure(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level nonCancellationLevel, Exception failure, String message, Object... params) Logs an exchange failure atnonCancellationLevel, unless it is a cancellation. Cancellations are expected teardown (for example the query reached its LIMIT and the exchange was closed early via a synthesized "client stopped" error, or the task was cancelled), so they are logged at DEBUG to keep genuine failures visible. Shared by the client, the server, and the operator driving them, so the caller supplies its own logger.- Parameters:
logger- the logger to log to (the caller's own logger)nonCancellationLevel- the level to log at when the failure is not a cancellationfailure- the failure that decides the log level (cancellations are logged at DEBUG)message- a parameterized log message templateparams- the parameters for the message template; a trailingThrowableis logged with its stack trace
-
buildClientToServerId
Constructs the client-to-server exchange ID from the session ID. -
buildServerToClientId
Constructs the server-to-client exchange ID from the session ID. -
connectRemoteSink
protected void connectRemoteSink(DiscoveryNode node, String exchangeId, ExchangeSourceHandler sourceHandler, ActionListener<Void> listener, String errorMessagePrefix) Connects a remote sink to a source handler via transport. This is a common pattern used by both server and client to establish transport-based connections for bidirectional exchange.Always uses failFast=true so the source handler aborts immediately on sink failure. The caller collects the real error via the listener and an
EsqlRefCountingListenerwhoseFailureCollectorpicks it over the genericTaskCancelledExceptionthrown by the aborted source.
-