Package io.temporal.internal.worker
Class SyncActivityWorker
- java.lang.Object
-
- io.temporal.internal.worker.SyncActivityWorker
-
- All Implemented Interfaces:
Shutdownable
,Startable
,Suspendable
,SuspendableWorker
public class SyncActivityWorker extends java.lang.Object implements SuspendableWorker
Activity worker that supports POJO activity implementations.
-
-
Constructor Summary
Constructors Constructor Description SyncActivityWorker(io.temporal.serviceclient.WorkflowServiceStubs service, java.lang.String namespace, java.lang.String taskQueue, double taskQueueActivitiesPerSecond, SingleWorkerOptions options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)
EagerActivityDispatcher
getEagerActivityDispatcher()
boolean
isShutdown()
boolean
isStarted()
boolean
isSuspended()
boolean
isTerminated()
void
registerActivityImplementations(java.lang.Object... activitiesImplementation)
void
resumePolling()
Allow new poll requests.java.util.concurrent.CompletableFuture<java.lang.Void>
shutdown(ShutdownManager shutdownManager, boolean interruptTasks)
void
start()
void
suspendPolling()
Do not make new poll requests.java.lang.String
toString()
-
-
-
Constructor Detail
-
SyncActivityWorker
public SyncActivityWorker(io.temporal.serviceclient.WorkflowServiceStubs service, java.lang.String namespace, java.lang.String taskQueue, double taskQueueActivitiesPerSecond, SingleWorkerOptions options)
-
-
Method Detail
-
registerActivityImplementations
public void registerActivityImplementations(java.lang.Object... activitiesImplementation)
-
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
-
suspendPolling
public void suspendPolling()
Description copied from interface:Suspendable
Do not make new poll requests. Outstanding long polls still can return tasks after this method was called.- Specified by:
suspendPolling
in interfaceSuspendable
-
resumePolling
public void resumePolling()
Description copied from interface:Suspendable
Allow new poll requests.- Specified by:
resumePolling
in interfaceSuspendable
-
isSuspended
public boolean isSuspended()
- Specified by:
isSuspended
in interfaceSuspendable
-
getEagerActivityDispatcher
public EagerActivityDispatcher getEagerActivityDispatcher()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-