Module org.elasticsearch.server
Package org.elasticsearch.action
Class ActionListenerResponseHandler<Response extends TransportResponse>
java.lang.Object
org.elasticsearch.action.ActionListenerResponseHandler<Response>
- All Implemented Interfaces:
Writeable.Reader<Response>
,TransportResponseHandler<Response>
- Direct Known Subclasses:
CleanableResponseHandler
public class ActionListenerResponseHandler<Response extends TransportResponse>
extends Object
implements TransportResponseHandler<Response>
An adapter for handling transport responses using an
ActionListener
.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.transport.TransportResponseHandler
TransportResponseHandler.Empty
-
Field Summary
FieldsFields inherited from interface org.elasticsearch.transport.TransportResponseHandler
TRANSPORT_WORKER
-
Constructor Summary
ConstructorsConstructorDescriptionActionListenerResponseHandler
(ActionListener<? super Response> listener, Writeable.Reader<Response> reader, Executor executor) -
Method Summary
Modifier and TypeMethodDescriptionexecutor()
void
void
handleResponse
(Response response) read
(StreamInput in) ReadV
-type value from a stream.toString()
-
Field Details
-
listener
-
-
Constructor Details
-
ActionListenerResponseHandler
public ActionListenerResponseHandler(ActionListener<? super Response> listener, Writeable.Reader<Response> reader, Executor executor) - Parameters:
listener
- The listener to notify with the transport response received.reader
- Used to deserialize the response.executor
- The executor to use to deserialize the response and notify the listener. You must only useEsExecutors.DIRECT_EXECUTOR_SERVICE
(or equivalentlyTransportResponseHandler.TRANSPORT_WORKER
) for very performance-critical actions, and even then only if the deserialization and handling work is very cheap, because this executor will perform all the work for responses from remote nodes on the receiving transport worker itself.
-
-
Method Details
-
handleResponse
- Specified by:
handleResponse
in interfaceTransportResponseHandler<Response extends TransportResponse>
-
handleException
- Specified by:
handleException
in interfaceTransportResponseHandler<Response extends TransportResponse>
-
executor
- Specified by:
executor
in interfaceTransportResponseHandler<Response extends TransportResponse>
- Returns:
- the executor to use to deserialize the response and notify the listener. You must only use
EsExecutors.DIRECT_EXECUTOR_SERVICE
(or equivalentlyTransportResponseHandler.TRANSPORT_WORKER
) for very performance-critical actions, and even then only if the deserialization and handling work is very cheap, because this executor will perform all the work for responses from remote nodes on the receiving transport worker itself.
-
read
Description copied from interface:Writeable.Reader
ReadV
-type value from a stream.- Specified by:
read
in interfaceWriteable.Reader<Response extends TransportResponse>
- Parameters:
in
- Input to read the value from- Throws:
IOException
-
toString
-