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.ObjectThis class is a registry that allows
-
-
Constructor Summary
Constructors Constructor Description ResponseHandlers()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longadd(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).java.util.List<Transport.ResponseContext<? extends TransportResponse>>prune(java.util.function.Predicate<Transport.ResponseContext> predicate)Removes and returns allTransport.ResponseContextinstances that match the predicateTransport.ResponseContextremove(long requestId)Removes and return theTransport.ResponseContextfor the given request ID or returnsnullif no context is associated with this request ID.
-
-
-
Method Detail
-
contains
public boolean contains(long requestId)
Returnstrueif the give request ID has a context associated with it.
-
remove
public Transport.ResponseContext remove(long requestId)
Removes and return theTransport.ResponseContextfor the given request ID or returnsnullif no context is associated with this request ID.
-
add
public long add(Transport.ResponseContext<? extends TransportResponse> holder)
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.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.
-
-