Package org.elasticsearch.transport
Class Transport.ResponseHandlers
java.lang.Object
org.elasticsearch.transport.Transport.ResponseHandlers
- Enclosing interface:
- Transport
This class is a registry that allows
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongadd(Transport.ResponseContext<? extends TransportResponse> holder)Adds a new response context and associates it with a new request ID.booleancontains(long requestId)Returnstrueif the give request ID has a context associated with it.TransportResponseHandler<? extends TransportResponse>onResponseReceived(long requestId, TransportMessageListener listener)called by theTransportimplementation when a response or an exception has been received for a previously sent request (before any processing or deserialization was done).List<Transport.ResponseContext<? extends TransportResponse>>prune(Predicate<Transport.ResponseContext<? extends TransportResponse>> predicate)Removes and returns allTransport.ResponseContextinstances that match the predicateTransport.ResponseContext<? extends TransportResponse>remove(long requestId)Removes and return theTransport.ResponseContextfor the given request ID or returnsnullif no context is associated with this request ID.
-
Constructor Details
-
ResponseHandlers
public ResponseHandlers()
-
-
Method Details
-
contains
public boolean contains(long requestId)Returnstrueif the give request ID has a context associated with it. -
remove
Removes and return theTransport.ResponseContextfor the given request ID or returnsnullif 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 List<Transport.ResponseContext<? extends TransportResponse>> prune(Predicate<Transport.ResponseContext<? extends TransportResponse>> predicate)Removes and returns allTransport.ResponseContextinstances that match the predicate -
onResponseReceived
public TransportResponseHandler<? extends TransportResponse> onResponseReceived(long requestId, TransportMessageListener listener)called by theTransportimplementation 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.
-