Package io.temporal.internal.worker
Class PollWorkflowTaskDispatcher
- java.lang.Object
-
- io.temporal.internal.worker.PollWorkflowTaskDispatcher
-
- All Implemented Interfaces:
Shutdownable
,ShutdownableTaskExecutor<io.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse>
public final class PollWorkflowTaskDispatcher extends java.lang.Object implements ShutdownableTaskExecutor<io.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse>
-
-
Constructor Summary
Constructors Constructor Description PollWorkflowTaskDispatcher(io.temporal.serviceclient.WorkflowServiceStubs service, java.lang.String namespace, com.uber.m3.tally.Scope metricsScope)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)
boolean
isShutdown()
boolean
isTerminated()
void
process(io.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse task)
java.util.concurrent.CompletableFuture<java.lang.Void>
shutdown(ShutdownManager shutdownManager, boolean interruptTasks)
void
subscribe(java.lang.String taskQueue, Functions.Proc1<io.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse> consumer)
-
-
-
Method Detail
-
process
public void process(io.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse task)
-
subscribe
public void subscribe(java.lang.String taskQueue, Functions.Proc1<io.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse> consumer)
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfaceShutdownable
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfaceShutdownable
-
shutdown
public java.util.concurrent.CompletableFuture<java.lang.Void> shutdown(ShutdownManager shutdownManager, boolean interruptTasks)
- Specified by:
shutdown
in interfaceShutdownable
- Parameters:
shutdownManager
- provides toolset to get a Future for a shutdown of instances that have both non-blocking and not returning a Future on a completion shutdown methods (likeExecutorService.shutdown()
)interruptTasks
- if the threads processing user code (like workflows, workflow tasks or activities) should be interrupted, or we want to wait for their full graceful completion- Returns:
- CompletableFuture which should be completed when awaiting downstream dependencies can
proceed with their own shutdown. Should never be completed exceptionally
CompletableFuture.exceptionally(Function)
as downstream dependencies have no use of this information (they need to perform a shutdown anyway), and it complicates the shutdown flow.
-
awaitTermination
public void awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)
- Specified by:
awaitTermination
in interfaceShutdownable
-
-