/** * Send a {@link GetRequest} to the tasks index looking for a persisted copy of the task completed task. It'll only be found only if the * task's result was stored. Called on the node that once had the task if that node is still part of the cluster or on the * coordinating node if the node is no longer part of the cluster. */ void getFinishedTaskFromIndex(Task thisTask, GetTaskRequest request, ActionListener<GetTaskResponse> listener) { GetRequest get = new GetRequest(TaskResultsService.TASK_INDEX, TaskResultsService.TASK_TYPE, request.getTaskId().toString()); get.setParentTask(clusterService.localNode().getId(), thisTask.getId()); client.get(get, new ActionListener<GetResponse>() { @Override public void onResponse(GetResponse getResponse) { try { onGetFinishedTaskFromIndex(getResponse, listener); } catch (Exception e) { listener.onFailure(e); } } @Override public void onFailure(Exception e) { if (ExceptionsHelper.unwrap(e, IndexNotFoundException.class) != null) { // We haven't yet created the index for the task results so it can't be found. listener.onFailure(new ResourceNotFoundException("task [{}] isn't running and hasn't stored its results", e, request.getTaskId())); } else { listener.onFailure(e); } } }); }
/** * Send a {@link GetRequest} to the tasks index looking for a persisted copy of the task completed task. It'll only be found only if the * task's result was stored. Called on the node that once had the task if that node is still part of the cluster or on the * coordinating node if the node is no longer part of the cluster. */ void getFinishedTaskFromIndex(Task thisTask, GetTaskRequest request, ActionListener<GetTaskResponse> listener) { GetRequest get = new GetRequest(TaskResultsService.TASK_INDEX, TaskResultsService.TASK_TYPE, request.getTaskId().toString()); get.setParentTask(clusterService.localNode().getId(), thisTask.getId()); client.get(get, new ActionListener<GetResponse>() { @Override public void onResponse(GetResponse getResponse) { try { onGetFinishedTaskFromIndex(getResponse, listener); } catch (Exception e) { listener.onFailure(e); } } @Override public void onFailure(Exception e) { if (ExceptionsHelper.unwrap(e, IndexNotFoundException.class) != null) { // We haven't yet created the index for the task results so it can't be found. listener.onFailure(new ResourceNotFoundException("task [{}] isn't running and hasn't stored its results", e, request.getTaskId())); } else { listener.onFailure(e); } } }); }
/** * Send a {@link GetRequest} to the tasks index looking for a persisted copy of the task completed task. It'll only be found only if the * task's result was stored. Called on the node that once had the task if that node is still part of the cluster or on the * coordinating node if the node is no longer part of the cluster. */ void getFinishedTaskFromIndex(Task thisTask, GetTaskRequest request, ActionListener<GetTaskResponse> listener) { GetRequest get = new GetRequest(TaskResultsService.TASK_INDEX, TaskResultsService.TASK_TYPE, request.getTaskId().toString()); get.setParentTask(clusterService.localNode().getId(), thisTask.getId()); client.get(get, new ActionListener<GetResponse>() { @Override public void onResponse(GetResponse getResponse) { try { onGetFinishedTaskFromIndex(getResponse, listener); } catch (Exception e) { listener.onFailure(e); } } @Override public void onFailure(Exception e) { if (ExceptionsHelper.unwrap(e, IndexNotFoundException.class) != null) { // We haven't yet created the index for the task results so it can't be found. listener.onFailure(new ResourceNotFoundException("task [{}] isn't running and hasn't stored its results", e, request.getTaskId())); } else { listener.onFailure(e); } } }); }
/** * Send a {@link GetRequest} to the tasks index looking for a persisted copy of the task completed task. It'll only be found only if the * task's result was stored. Called on the node that once had the task if that node is still part of the cluster or on the * coordinating node if the node is no longer part of the cluster. */ void getFinishedTaskFromIndex(Task thisTask, GetTaskRequest request, ActionListener<GetTaskResponse> listener) { GetRequest get = new GetRequest(TaskResultsService.TASK_INDEX, TaskResultsService.TASK_TYPE, request.getTaskId().toString()); get.setParentTask(clusterService.localNode().getId(), thisTask.getId()); client.get(get, new ActionListener<GetResponse>() { @Override public void onResponse(GetResponse getResponse) { try { onGetFinishedTaskFromIndex(getResponse, listener); } catch (Exception e) { listener.onFailure(e); } } @Override public void onFailure(Exception e) { if (ExceptionsHelper.unwrap(e, IndexNotFoundException.class) != null) { // We haven't yet created the index for the task results so it can't be found. listener.onFailure(new ResourceNotFoundException("task [{}] isn't running and hasn't stored its results", e, request.getTaskId())); } else { listener.onFailure(e); } } }); }