Tabnine Logo
Task.getId
Code IndexAdd Tabnine to your IDE (free)

How to use
getId
method
in
org.elasticsearch.tasks.Task

Best Java code snippets using org.elasticsearch.tasks.Task.getId (Showing top 20 results out of 315)

origin: org.elasticsearch/elasticsearch

@Override
public void onResponse(Task task, Response response) {
  logger.info("{} finished with response {}", task.getId(), response);
}
origin: org.elasticsearch/elasticsearch

  @Override
  public void onFailure(Task task, Throwable e) {
    logger.warn(() -> new ParameterizedMessage("{} failed with exception", task.getId()), e);
  }
}
origin: org.elasticsearch/elasticsearch

/**
 * Unregister the task
 */
public Task unregister(Task task) {
  logger.trace("unregister task for id: {}", task.getId());
  if (task instanceof CancellableTask) {
    CancellableTaskHolder holder = cancellableTasks.remove(task.getId());
    if (holder != null) {
      holder.finish();
      return holder.getTask();
    } else {
      return null;
    }
  } else {
    return tasks.remove(task.getId());
  }
}
origin: org.elasticsearch/elasticsearch

/**
 * Convenience constructor for building the TaskId out of what is usually at hand.
 */
public ParentTaskAssigningClient(Client in, DiscoveryNode localNode, Task parentTask) {
  this(in, new TaskId(localNode.getId(), parentTask.getId()));
}
origin: org.elasticsearch/elasticsearch

/**
 * Blocks the calling thread, waiting for the task to vanish from the TaskManager.
 */
public void waitForTaskCompletion(Task task, long untilInNanos) {
  while (System.nanoTime() - untilInNanos < 0) {
    if (getTask(task.getId()) == null) {
      return;
    }
    try {
      Thread.sleep(WAIT_FOR_COMPLETION_POLL.millis());
    } catch (InterruptedException e) {
      throw new ElasticsearchException("Interrupted waiting for completion of [{}]", e, task);
    }
  }
  throw new ElasticsearchTimeoutException("Timed out waiting for completion of [{}]", task);
}
origin: org.elasticsearch/elasticsearch

/**
 * Build a proper {@link TaskInfo} for this task.
 */
protected final TaskInfo taskInfo(String localNodeId, String description, Status status) {
  return new TaskInfo(new TaskId(localNodeId, getId()), getType(), getAction(), description, status, startTime,
      System.nanoTime() - startTimeNanos, this instanceof CancellableTask, parentTask, headers);
}
origin: org.elasticsearch/elasticsearch

private void registerCancellableTask(Task task) {
  CancellableTask cancellableTask = (CancellableTask) task;
  CancellableTaskHolder holder = new CancellableTaskHolder(cancellableTask);
  CancellableTaskHolder oldHolder = cancellableTasks.put(task.getId(), holder);
  assert oldHolder == null;
  // Check if this task was banned before we start it
  if (task.getParentTaskId().isSet() && banedParents.isEmpty() == false) {
    String reason = banedParents.get(task.getParentTaskId());
    if (reason != null) {
      try {
        holder.cancel(reason);
        throw new IllegalStateException("Task cancelled before it started: " + reason);
      } finally {
        // let's clean up the registration
        unregister(task);
      }
    }
  }
}
origin: org.elasticsearch/elasticsearch

protected void shardExecute(Task task, Request request, ShardId shardId, ActionListener<ShardResponse> shardActionListener) {
  ShardRequest shardRequest = newShardRequest(request, shardId);
  shardRequest.setParentTask(clusterService.localNode().getId(), task.getId());
  replicatedBroadcastShardAction.execute(shardRequest, shardActionListener);
}
origin: org.elasticsearch/elasticsearch

  logger.trace("register {} [{}] [{}] [{}]", task.getId(), type, action, task.getDescription());
  registerCancellableTask(task);
} else {
  Task previousTask = tasks.put(task.getId(), task);
  assert previousTask == null;
origin: org.elasticsearch/elasticsearch

  private void respondIfFinished() {
    if (counter.decrementAndGet() != 0) {
      return;
    }
    List<TaskResponse> results = new ArrayList<>();
    List<TaskOperationFailure> exceptions = new ArrayList<>();
    for (Tuple<TaskResponse, Exception> response : responses.asList()) {
      if (response.v1() == null) {
        assert response.v2() != null;
        exceptions.add(new TaskOperationFailure(clusterService.localNode().getId(), tasks.get(taskIndex).getId(),
            response.v2()));
      } else {
        assert response.v2() == null;
        results.add(response.v1());
      }
    }
    listener.onResponse(new NodeTasksResponse(clusterService.localNode().getId(), results, exceptions));
  }
};
origin: org.elasticsearch/elasticsearch

public <T extends TransportResponse> void sendChildRequest(final Transport.Connection connection, final String action,
                              final TransportRequest request, final Task parentTask,
                              final TransportRequestOptions options,
                              final TransportResponseHandler<T> handler) {
  request.setParentTask(localNode.getId(), parentTask.getId());
  try {
    sendRequest(connection, action, request, options, handler);
  } catch (TaskCancelledException ex) {
    // The parent task is already cancelled - just fail the request
    handler.handleException(new TransportException(ex));
  } catch (NodeNotConnectedException ex) {
    // the caller might not handle this so we invoke the handler
    handler.handleException(ex);
  }
}
origin: org.elasticsearch/elasticsearch

/**
 * 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);
      }
    }
  });
}
origin: org.elasticsearch/elasticsearch

  public boolean match(Task task) {
    if (getActions() != null && getActions().length > 0 && Regex.simpleMatch(getActions(), task.getAction()) == false) {
      return false;
    }
    if (getTaskId().isSet()) {
      if(getTaskId().getId() != task.getId()) {
        return false;
      }
    }
    if (parentTaskId.isSet()) {
      if (parentTaskId.equals(task.getParentTaskId()) == false) {
        return false;
      }
    }
    return true;
  }
}
origin: org.elasticsearch/elasticsearch

bulkShardRequest.timeout(bulkRequest.timeout());
if (task != null) {
  bulkShardRequest.setParentTask(nodeId, task.getId());
origin: com.strapdata.elasticsearch/elasticsearch

  @Override
  public void onFailure(Task task, Throwable e) {
    logger.warn((Supplier<?>) () -> new ParameterizedMessage("{} failed with exception", task.getId()), e);
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

  @Override
  public void onFailure(Task task, Throwable e) {
    logger.warn(() -> new ParameterizedMessage("{} failed with exception", task.getId()), e);
  }
}
origin: org.elasticsearch/elasticsearch

  return;
GetTaskRequest nodeRequest = request.nodeRequest(clusterService.localNode().getId(), thisTask.getId());
transportService.sendRequest(node, GetTaskAction.NAME, nodeRequest, builder.build(),
    new TransportResponseHandler<GetTaskResponse>() {
origin: org.elasticsearch.module/reindex

  private void sendTask(RestChannel channel, Task task) throws IOException {
    XContentBuilder builder = channel.newBuilder();
    builder.startObject();
    builder.field("task", clusterService.localNode().getId() + ":" + task.getId());
    builder.endObject();
    channel.sendResponse(new BytesRestResponse(RestStatus.OK, builder));
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

protected void shardExecute(Task task, Request request, ShardId shardId, ActionListener<ShardResponse> shardActionListener) {
  ShardRequest shardRequest = newShardRequest(request, shardId);
  shardRequest.setParentTask(clusterService.localNode().getId(), task.getId());
  replicatedBroadcastShardAction.execute(shardRequest, shardActionListener);
}
origin: harbby/presto-connectors

protected void shardExecute(Task task, Request request, ShardId shardId, ActionListener<ShardResponse> shardActionListener) {
  ShardRequest shardRequest = newShardRequest(request, shardId);
  shardRequest.setParentTask(clusterService.localNode().getId(), task.getId());
  taskManager.registerChildTask(task, clusterService.localNode().getId());
  replicatedBroadcastShardAction.execute(shardRequest, shardActionListener);
}
org.elasticsearch.tasksTaskgetId

Javadoc

Returns task id

Popular methods of Task

  • getAction
    Returns task action
  • taskInfo
    Build a version of the task status you can throw over the wire and back to the user.
  • <init>
  • getDescription
    Generates task description
  • getParentTaskId
    Returns id of the parent task or NO_PARENT_ID if the task doesn't have any parent tasks
  • getStatus
    Build a status for this task or null if this task doesn't have status. Since most tasks don't have s
  • getType
    Returns task channel type (netty, transport, direct)
  • result

Popular in Java

  • Making http requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • getResourceAsStream (ClassLoader)
  • onRequestPermissionsResult (Fragment)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • JOptionPane (javax.swing)
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now