Package io.trino.server.remotetask
Class TaskInfoFetcher
- java.lang.Object
-
- io.trino.server.remotetask.TaskInfoFetcher
-
- All Implemented Interfaces:
SimpleHttpResponseCallback<TaskInfo>
public class TaskInfoFetcher extends Object implements SimpleHttpResponseCallback<TaskInfo>
-
-
Constructor Summary
Constructors Constructor Description TaskInfoFetcher(Consumer<Throwable> onFail, TaskInfo initialTask, io.airlift.http.client.HttpClient httpClient, io.airlift.units.Duration updateInterval, io.airlift.json.JsonCodec<TaskInfo> taskInfoCodec, io.airlift.units.Duration maxErrorDuration, boolean summarizeTaskInfo, Executor executor, ScheduledExecutorService updateScheduledExecutor, ScheduledExecutorService errorScheduledExecutor, RemoteTaskStats stats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFinalTaskInfoListener(StateMachine.StateChangeListener<TaskInfo> stateChangeListener)Add a listener for the final task info.voidfailed(Throwable cause)voidfatal(Throwable cause)TaskInfogetTaskInfo()voidstart()voidsuccess(TaskInfo newValue)
-
-
-
Constructor Detail
-
TaskInfoFetcher
public TaskInfoFetcher(Consumer<Throwable> onFail, TaskInfo initialTask, io.airlift.http.client.HttpClient httpClient, io.airlift.units.Duration updateInterval, io.airlift.json.JsonCodec<TaskInfo> taskInfoCodec, io.airlift.units.Duration maxErrorDuration, boolean summarizeTaskInfo, Executor executor, ScheduledExecutorService updateScheduledExecutor, ScheduledExecutorService errorScheduledExecutor, RemoteTaskStats stats)
-
-
Method Detail
-
getTaskInfo
public TaskInfo getTaskInfo()
-
start
public void start()
-
addFinalTaskInfoListener
public void addFinalTaskInfoListener(StateMachine.StateChangeListener<TaskInfo> stateChangeListener)
Add a listener for the final task info. This notification is guaranteed to be fired only once. Listener is always notified asynchronously using a dedicated notification thread pool so, care should be taken to avoid leakingthiswhen adding a listener in a constructor. Additionally, it is possible notifications are observed out of order due to the asynchronous execution.
-
success
public void success(TaskInfo newValue)
- Specified by:
successin interfaceSimpleHttpResponseCallback<TaskInfo>
-
failed
public void failed(Throwable cause)
- Specified by:
failedin interfaceSimpleHttpResponseCallback<TaskInfo>
-
fatal
public void fatal(Throwable cause)
- Specified by:
fatalin interfaceSimpleHttpResponseCallback<TaskInfo>
-
-