Package org.apache.polaris.service.task
Class TaskExecutorImpl
java.lang.Object
org.apache.polaris.service.task.TaskExecutorImpl
- All Implemented Interfaces:
TaskExecutor
Given a list of registered
TaskHandlers, execute tasks asynchronously with the provided
CallContext.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTaskExecutorImpl(Executor executor, Clock clock, org.apache.polaris.core.persistence.MetaStoreManagerFactory metaStoreManagerFactory, TaskFileIOSupplier fileIOSupplier, PolarisEventListener polarisEventListener, io.opentelemetry.api.trace.Tracer tracer) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTaskHandler(TaskHandler taskHandler) Add aTaskHandler.voidaddTaskHandlerContext(long taskEntityId, org.apache.polaris.core.context.CallContext callContext) Register aCallContextfor a specific task id.protected voidhandleTask(long taskEntityId, org.apache.polaris.core.context.CallContext ctx, int attempt) protected voidhandleTaskWithTracing(long taskEntityId, org.apache.polaris.core.context.CallContext callContext, int attempt) voidinit()
-
Constructor Details
-
TaskExecutorImpl
protected TaskExecutorImpl() -
TaskExecutorImpl
@Inject public TaskExecutorImpl(@Identifier("task-executor") Executor executor, Clock clock, org.apache.polaris.core.persistence.MetaStoreManagerFactory metaStoreManagerFactory, TaskFileIOSupplier fileIOSupplier, PolarisEventListener polarisEventListener, @Nullable io.opentelemetry.api.trace.Tracer tracer)
-
-
Method Details
-
init
public void init() -
addTaskHandler
Add aTaskHandler.TaskEntitys will be tested against theTaskHandler.canHandleTask(TaskEntity)method and will be handled by the first handler that responds true. -
addTaskHandlerContext
public void addTaskHandlerContext(long taskEntityId, org.apache.polaris.core.context.CallContext callContext) Register aCallContextfor a specific task id. That task will be loaded and executed asynchronously with a clone of the providedCallContext.- Specified by:
addTaskHandlerContextin interfaceTaskExecutor
-
handleTask
protected void handleTask(long taskEntityId, org.apache.polaris.core.context.CallContext ctx, int attempt) -
handleTaskWithTracing
protected void handleTaskWithTracing(long taskEntityId, org.apache.polaris.core.context.CallContext callContext, int attempt)
-