Skip to content

Commit e793db8

Browse files
Make asyncThrottlerExecutor use a daemon thread (#2528)
1 parent 437c612 commit e793db8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

temporal-sdk/src/main/java/io/temporal/internal/client/external/GenericWorkflowClientImpl.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import static io.temporal.serviceclient.MetricsTag.METRICS_TAGS_CALL_OPTIONS_KEY;
55

66
import com.google.common.util.concurrent.ListenableFuture;
7+
import com.google.common.util.concurrent.ThreadFactoryBuilder;
78
import com.uber.m3.tally.Scope;
89
import com.uber.m3.util.ImmutableMap;
910
import io.grpc.Deadline;
@@ -18,11 +19,12 @@
1819
import javax.annotation.Nonnull;
1920

2021
public final class GenericWorkflowClientImpl implements GenericWorkflowClient {
21-
22-
// TODO we need to shutdown this executor
2322
private static final ScheduledExecutorService asyncThrottlerExecutor =
24-
new ScheduledThreadPoolExecutor(1, r -> new Thread(r, "generic-wf-client-async-throttler"));
25-
23+
Executors.newSingleThreadScheduledExecutor(
24+
new ThreadFactoryBuilder()
25+
.setDaemon(true)
26+
.setNameFormat("generic-wf-client-async-throttler-%d")
27+
.build());
2628
private final WorkflowServiceStubs service;
2729
private final Scope metricsScope;
2830
private final GrpcRetryer grpcRetryer;

0 commit comments

Comments
 (0)