Skip to content

Refactor logger declaration #128457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
* use {@link ExchangeSourceHandler#addRemoteSink(RemoteSink, boolean, Runnable, int, ActionListener)}.
*/
public final class ExchangeService extends AbstractLifecycleComponent {

private static final Logger logger = LogManager.getLogger(ExchangeService.class);

// TODO: Make this a child action of the data node transport to ensure that exchanges
// are accessed only by the user initialized the session.
public static final String EXCHANGE_ACTION_NAME = "internal:data/read/esql/exchange";
Expand All @@ -71,8 +74,6 @@ public final class ExchangeService extends AbstractLifecycleComponent {
public static final String INACTIVE_SINKS_INTERVAL_SETTING = "esql.exchange.sink_inactive_interval";
public static final TimeValue INACTIVE_SINKS_INTERVAL_DEFAULT = TimeValue.timeValueMinutes(5);

private static final Logger LOGGER = LogManager.getLogger(ExchangeService.class);

private final ThreadPool threadPool;
private final Executor executor;
private final BlockFactory blockFactory;
Expand All @@ -87,7 +88,7 @@ public ExchangeService(Settings settings, ThreadPool threadPool, String executor
final var inactiveInterval = settings.getAsTime(INACTIVE_SINKS_INTERVAL_SETTING, INACTIVE_SINKS_INTERVAL_DEFAULT);
// Run the reaper every half of the keep_alive interval
this.threadPool.scheduleWithFixedDelay(
new InactiveSinksReaper(LOGGER, threadPool, inactiveInterval),
new InactiveSinksReaper(threadPool, inactiveInterval),
TimeValue.timeValueMillis(Math.max(1, inactiveInterval.millis() / 2)),
executor
);
Expand Down Expand Up @@ -249,12 +250,10 @@ public void messageReceived(ExchangeRequest request, TransportChannel channel, T
}

private final class InactiveSinksReaper extends AbstractRunnable {
private final Logger logger;
private final TimeValue keepAlive;
private final ThreadPool threadPool;

InactiveSinksReaper(Logger logger, ThreadPool threadPool, TimeValue keepAlive) {
this.logger = logger;
InactiveSinksReaper(ThreadPool threadPool, TimeValue keepAlive) {
this.keepAlive = keepAlive;
this.threadPool = threadPool;
}
Expand Down