Class ShutdownManager
java.lang.Object
io.temporal.internal.worker.ShutdownManager
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longawaitTermination(Shutdownable s, long timeoutMillis) static longawaitTermination(ExecutorService s, long timeoutMillis) voidclose()static longrunAndGetRemainingTimeoutMs(long initialTimeoutMs, Runnable toRun) shutdownExecutor(ExecutorService executorToShutdown, String executorName, Duration timeout) executorToShutdown.shutdown() -> timed wait for graceful termination -> executorToShutdown.shutdownNow()shutdownExecutorNow(ExecutorService executorToShutdown, String executorName, Duration timeout) executorToShutdown.shutdownNow() -> timed wait for a graceful terminationshutdownExecutorNowUntimed(ExecutorService executorToShutdown, String executorName) executorToShutdown.shutdownNow() -> unlimited wait for terminationshutdownExecutorUntimed(ExecutorService executorToShutdown, String executorName) executorToShutdown.shutdown() -> unlimited wait for graceful terminationwaitForStickyQueueBalancer(io.temporal.internal.worker.DisableNormalPolling balancer, Duration timeout) waitForStickyQueueBalancer -> disableNormalPoll -> timed wait for graceful completion of sticky workflowswaitForSupplierPermitsReleasedUnlimited(TrackingSlotSupplier<?> slotSupplier, String name) waitOnWorkerShutdownRequest(com.google.common.util.concurrent.ListenableFuture<io.temporal.api.workflowservice.v1.ShutdownWorkerResponse> shutdownRequest) Wait forshutdownRequestto finish.
-
Constructor Details
-
ShutdownManager
public ShutdownManager() -
ShutdownManager
public ShutdownManager(int checkPeriodMs) - Parameters:
checkPeriodMs- interval in milliseconds between shutdown-completion polls. Lower values speed up teardown at the cost of more frequent polling. Must be positive.
-
-
Method Details
-
shutdownExecutorNow
public CompletableFuture<Void> shutdownExecutorNow(ExecutorService executorToShutdown, String executorName, Duration timeout) executorToShutdown.shutdownNow() -> timed wait for a graceful termination -
shutdownExecutorNowUntimed
public CompletableFuture<Void> shutdownExecutorNowUntimed(ExecutorService executorToShutdown, String executorName) executorToShutdown.shutdownNow() -> unlimited wait for termination -
shutdownExecutor
public CompletableFuture<Void> shutdownExecutor(ExecutorService executorToShutdown, String executorName, Duration timeout) executorToShutdown.shutdown() -> timed wait for graceful termination -> executorToShutdown.shutdownNow() -
shutdownExecutorUntimed
public CompletableFuture<Void> shutdownExecutorUntimed(ExecutorService executorToShutdown, String executorName) executorToShutdown.shutdown() -> unlimited wait for graceful termination -
waitForSupplierPermitsReleasedUnlimited
public CompletableFuture<Void> waitForSupplierPermitsReleasedUnlimited(TrackingSlotSupplier<?> slotSupplier, String name) -
waitForStickyQueueBalancer
public CompletableFuture<Void> waitForStickyQueueBalancer(io.temporal.internal.worker.DisableNormalPolling balancer, Duration timeout) waitForStickyQueueBalancer -> disableNormalPoll -> timed wait for graceful completion of sticky workflows -
waitOnWorkerShutdownRequest
public CompletableFuture<Void> waitOnWorkerShutdownRequest(com.google.common.util.concurrent.ListenableFuture<io.temporal.api.workflowservice.v1.ShutdownWorkerResponse> shutdownRequest) Wait forshutdownRequestto finish. shutdownRequest is considered best effort, so we do not fail the shutdown if it fails. -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
awaitTermination
-
runAndGetRemainingTimeoutMs
-
awaitTermination
-