Package org.elasticsearch.transport
Class Transport.ResponseHandlers
java.lang.Object
org.elasticsearch.transport.Transport.ResponseHandlers
- Enclosing interface:
- Transport
public static final class Transport.ResponseHandlers
extends java.lang.Object
This class is a registry that allows
-
Constructor Summary
Constructors Constructor Description ResponseHandlers()
-
Method Summary
Modifier and Type Method Description long
add(Transport.ResponseContext<? extends TransportResponse> holder)
Adds a new response context and associates it with a new request ID.boolean
contains(long requestId)
Returnstrue
if the give request ID has a context associated with it.TransportResponseHandler<? extends TransportResponse>
onResponseReceived(long requestId, TransportMessageListener listener)
called by theTransport
implementation when a response or an exception has been received for a previously sent request (before any processing or deserialization was done).java.util.List<Transport.ResponseContext<? extends TransportResponse>>
prune(java.util.function.Predicate<Transport.ResponseContext> predicate)
Removes and returns allTransport.ResponseContext
instances that match the predicateTransport.ResponseContext
remove(long requestId)
Removes and return theTransport.ResponseContext
for the given request ID or returnsnull
if no context is associated with this request ID.
-
Constructor Details
-
ResponseHandlers
public ResponseHandlers()
-
-
Method Details
-
contains
public boolean contains(long requestId)Returnstrue
if the give request ID has a context associated with it. -
remove
Removes and return theTransport.ResponseContext
for the given request ID or returnsnull
if no context is associated with this request ID. -
add
Adds a new response context and associates it with a new request ID.- Returns:
- the new request ID
- See Also:
Transport.Connection.sendRequest(long, String, TransportRequest, TransportRequestOptions)
-
prune
public java.util.List<Transport.ResponseContext<? extends TransportResponse>> prune(java.util.function.Predicate<Transport.ResponseContext> predicate)Removes and returns allTransport.ResponseContext
instances that match the predicate -
onResponseReceived
public TransportResponseHandler<? extends TransportResponse> onResponseReceived(long requestId, TransportMessageListener listener)called by theTransport
implementation when a response or an exception has been received for a previously sent request (before any processing or deserialization was done). Returns the appropriate response handler or null if not found.
-