Skip to content

Commit

Permalink
Shutdown SplitManager executor during cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pettyjamesm committed Nov 15, 2023
1 parent 062e30b commit 14b33c7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion core/trino-main/src/main/java/io/trino/split/SplitManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
import io.trino.spi.connector.Constraint;
import io.trino.spi.connector.DynamicFilter;
import io.trino.tracing.TrinoAttributes;
import jakarta.annotation.PreDestroy;

import java.util.Optional;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;

import static io.airlift.concurrent.Threads.daemonThreadsNamed;
import static io.trino.SystemSessionProperties.isAllowPushdownIntoConnectors;
Expand All @@ -44,6 +46,7 @@ public class SplitManager
private final CatalogServiceProvider<ConnectorSplitManager> splitManagerProvider;
private final Tracer tracer;
private final int minScheduleSplitBatchSize;
private final ExecutorService executorService;
private final Executor executor;

@Inject
Expand All @@ -52,7 +55,14 @@ public SplitManager(CatalogServiceProvider<ConnectorSplitManager> splitManagerPr
this.splitManagerProvider = requireNonNull(splitManagerProvider, "splitManagerProvider is null");
this.tracer = requireNonNull(tracer, "tracer is null");
this.minScheduleSplitBatchSize = config.getMinScheduleSplitBatchSize();
this.executor = new BoundedExecutor(newCachedThreadPool(daemonThreadsNamed("splits-manager-callback-%s")), config.getMaxSplitManagerCallbackThreads());
this.executorService = newCachedThreadPool(daemonThreadsNamed("splits-manager-callback-%s"));
this.executor = new BoundedExecutor(executorService, config.getMaxSplitManagerCallbackThreads());
}

@PreDestroy
public void shutdown()
{
executorService.shutdown();
}

public SplitSource getSplits(
Expand Down

0 comments on commit 14b33c7

Please sign in to comment.