Skip to content

Commit

Permalink
Move to doStart
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Jul 27, 2024
1 parent 777a546 commit 288d8f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public class ClusterApplierService extends AbstractLifecycleComponent implements

private final ClusterSettings clusterSettings;
protected final ThreadPool threadPool;
protected final InternalThreadContextWrapper tcWrapper;
protected volatile InternalThreadContextWrapper tcWrapper;

private volatile TimeValue slowTaskLoggingThreshold;

Expand Down Expand Up @@ -141,7 +141,6 @@ public ClusterApplierService(
) {
this.clusterSettings = clusterSettings;
this.threadPool = threadPool;
this.tcWrapper = InternalThreadContextWrapper.from(threadPool.getThreadContext());
this.state = new AtomicReference<>();
this.nodeName = nodeName;

Expand Down Expand Up @@ -176,6 +175,7 @@ protected synchronized void doStart() {
Objects.requireNonNull(nodeConnectionsService, "please set the node connection service before starting");
Objects.requireNonNull(state.get(), "please set initial state before starting");
threadPoolExecutor = createThreadPoolExecutor();
tcWrapper = InternalThreadContextWrapper.from(threadPool.getThreadContext());
}

protected PrioritizedOpenSearchThreadPoolExecutor createThreadPoolExecutor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public class MasterService extends AbstractLifecycleComponent {
private volatile TimeValue slowTaskLoggingThreshold;

protected final ThreadPool threadPool;
protected final InternalThreadContextWrapper tcWrapper;
protected volatile InternalThreadContextWrapper tcWrapper;

private volatile PrioritizedOpenSearchThreadPoolExecutor threadPoolExecutor;
private volatile Batcher taskBatcher;
Expand Down Expand Up @@ -171,7 +171,6 @@ public MasterService(
);
this.stateStats = new ClusterStateStats();
this.threadPool = threadPool;
this.tcWrapper = InternalThreadContextWrapper.from(threadPool.getThreadContext());
this.clusterManagerMetrics = clusterManagerMetrics;
}

Expand All @@ -193,6 +192,7 @@ protected synchronized void doStart() {
Objects.requireNonNull(clusterStateSupplier, "please set a cluster state supplier before starting");
threadPoolExecutor = createThreadPoolExecutor();
taskBatcher = new Batcher(logger, threadPoolExecutor, clusterManagerTaskThrottler);
tcWrapper = InternalThreadContextWrapper.from(threadPool.getThreadContext());
}

protected PrioritizedOpenSearchThreadPoolExecutor createThreadPoolExecutor() {
Expand Down

0 comments on commit 288d8f2

Please sign in to comment.