Java 类org.elasticsearch.client.FilterClient 实例源码

项目:elasticsearch_my    文件:AbstractClient.java   
@Override
public Client filterWithHeader(Map<String, String> headers) {
    return new FilterClient(this) {
        @Override
        protected <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> void doExecute(Action<Request, Response, RequestBuilder> action, Request request, ActionListener<Response> listener) {
            ThreadContext threadContext = threadPool().getThreadContext();
            try (ThreadContext.StoredContext ctx = threadContext.stashAndMergeHeaders(headers)) {
                super.doExecute(action, request, listener);
            }
        }
    };
}