use of com.facebook.airlift.concurrent.SetThreadName in project presto by prestodb.
the class ContinuousTaskStatusFetcher method fatal.
@Override
public void fatal(Throwable cause) {
try (SetThreadName ignored = new SetThreadName("ContinuousTaskStatusFetcher-%s", taskId)) {
updateStats(currentRequestStartNanos.get());
onFail.accept(cause);
}
}
use of com.facebook.airlift.concurrent.SetThreadName in project presto by prestodb.
the class ContinuousTaskStatusFetcher method success.
@Override
public void success(TaskStatus value) {
try (SetThreadName ignored = new SetThreadName("ContinuousTaskStatusFetcher-%s", taskId)) {
updateStats(currentRequestStartNanos.get());
try {
updateTaskStatus(value);
errorTracker.requestSucceeded();
} finally {
scheduleNextRequest();
}
}
}
use of com.facebook.airlift.concurrent.SetThreadName in project presto by prestodb.
the class HttpRemoteTask method start.
@Override
public void start() {
try (SetThreadName ignored = new SetThreadName("HttpRemoteTask-%s", taskId)) {
// to start we just need to trigger an update
started.set(true);
scheduleUpdate();
taskStatusFetcher.start();
taskInfoFetcher.start();
}
}
use of com.facebook.airlift.concurrent.SetThreadName in project presto by prestodb.
the class HttpRemoteTask method abort.
private synchronized void abort(TaskStatus status) {
checkState(status.getState().isDone(), "cannot abort task with an incomplete status");
try (SetThreadName ignored = new SetThreadName("HttpRemoteTask-%s", taskId)) {
taskStatusFetcher.updateTaskStatus(status);
// send abort to task
HttpUriBuilder uriBuilder = getHttpUriBuilder(getTaskStatus());
Request request = setContentTypeHeaders(binaryTransportEnabled, prepareDelete()).setUri(uriBuilder.build()).build();
scheduleAsyncCleanupRequest(createCleanupBackoff(), request, "abort");
}
}
use of com.facebook.airlift.concurrent.SetThreadName in project presto by prestodb.
the class HttpRemoteTask method cancel.
@Override
public synchronized void cancel() {
try (SetThreadName ignored = new SetThreadName("HttpRemoteTask-%s", taskId)) {
TaskStatus taskStatus = getTaskStatus();
if (taskStatus.getState().isDone()) {
return;
}
// send cancel to task and ignore response
HttpUriBuilder uriBuilder = getHttpUriBuilder(taskStatus).addParameter("abort", "false");
Request request = setContentTypeHeaders(binaryTransportEnabled, prepareDelete()).setUri(uriBuilder.build()).build();
scheduleAsyncCleanupRequest(createCleanupBackoff(), request, "cancel");
}
}
Aggregations