public void handleRequest()

in src/main/java/org/opensearch/search/asynchronous/transport/TransportGetAsynchronousSearchAction.java [54:83]


    public void handleRequest(AsynchronousSearchId asynchronousSearchId, GetAsynchronousSearchRequest request,
                              ActionListener<AsynchronousSearchResponse> listener, User user) {
        try {
            boolean updateNeeded = request.getKeepAlive() != null;
            if (updateNeeded) {
                asynchronousSearchService.updateKeepAliveAndGetContext(request.getId(), request.getKeepAlive(),
                        asynchronousSearchId.getAsynchronousSearchContextId(), user, ActionListener.wrap(
                                // check if the context is active and is still RUNNING
                                (context) -> handleWaitForCompletion(context, request, listener),
                                (e) -> {
                                    logger.debug(() -> new ParameterizedMessage("Unable to update and get asynchronous search request [{}]",
                                            asynchronousSearchId), e);
                                    listener.onFailure(e);
                                }
                        ));
            } else {
                // we don't need to update keep-alive, simply find one on the node if one exists or look up the index
                asynchronousSearchService.findContext(request.getId(), asynchronousSearchId.getAsynchronousSearchContextId(), user,
                        ActionListener.wrap((context) -> handleWaitForCompletion(context, request, listener),
                        (e) -> {
                            logger.debug(() -> new ParameterizedMessage("Unable to get asynchronous search [{}]",
                                    asynchronousSearchId), e);
                            listener.onFailure(e);
                        }));
            }
        } catch (Exception e) {
            logger.error(() -> new ParameterizedMessage("Unable to update and get asynchronous search [{}]", request.getId()), e);
            listener.onFailure(e);
        }
    }