Package org.elasticsearch.transport
Class Transport.ResponseHandlers
org.elasticsearch.transport.Transport.ResponseHandlers
- Enclosing interface:
- Transport
public static final class Transport.ResponseHandlers
extends
This class is a registry that allows
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
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).<Transport.ResponseContext<? extends TransportResponse>>
<Transport.ResponseContext<? extends TransportResponse>> predicate)
Removes and returns allTransport.ResponseContext
instances that match the predicateTransport.ResponseContext<? extends TransportResponse>
remove(long requestId)
Removes and return theTransport.ResponseContext
for the given request ID or returnsnull
if no context is associated with this request ID.Methods inherited from class java.lang.
, , , , , , , , , ,
-
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 <<Transport.ResponseContext<? extends TransportResponse>> 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.
-