Skip to content

Remove consumer executor service #94

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 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
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
18 changes: 0 additions & 18 deletions src/main/java/com/rabbitmq/client/amqp/impl/AmqpEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ class AmqpEnvironment implements Environment {
private final AtomicBoolean closed = new AtomicBoolean(false);
private final boolean internalExecutor;
private final boolean internalScheduledExecutor;
private final boolean internalConsumerExecutor;
private final boolean internalPublisherExecutor;
private final ExecutorService executorService;
private final ScheduledExecutorService scheduledExecutorService;
private final ExecutorService publisherExecutorService;
private final ExecutorService consumerExecutorService;
private final ConnectionManager connectionManager = new ConnectionManager(this);
private final long id;
private final Clock clock = new Clock();
Expand All @@ -58,7 +56,6 @@ class AmqpEnvironment implements Environment {
ExecutorService executorService,
ScheduledExecutorService scheduledExecutorService,
ExecutorService publisherExecutorService,
ExecutorService consumerExecutorService,
DefaultConnectionSettings<?> connectionSettings,
MetricsCollector metricsCollector,
ObservationCollector observationCollector) {
Expand Down Expand Up @@ -91,14 +88,6 @@ class AmqpEnvironment implements Environment {
this.publisherExecutorService = publisherExecutorService;
this.internalPublisherExecutor = false;
}
if (consumerExecutorService == null) {
this.consumerExecutorService =
Executors.newCachedThreadPool(Utils.threadFactory(threadPrefix + "consumer-"));
this.internalConsumerExecutor = true;
} else {
this.consumerExecutorService = consumerExecutorService;
this.internalConsumerExecutor = false;
}
this.metricsCollector =
metricsCollector == null ? NoOpMetricsCollector.INSTANCE : metricsCollector;
this.observationCollector =
Expand Down Expand Up @@ -147,9 +136,6 @@ public void close() {
if (this.internalPublisherExecutor) {
this.publisherExecutorService.shutdownNow();
}
if (this.internalConsumerExecutor) {
this.consumerExecutorService.shutdownNow();
}
if (this.clockRefreshFuture != null) {
this.clockRefreshFuture.cancel(false);
}
Expand All @@ -170,10 +156,6 @@ ExecutorService publisherExecutorService() {
return this.publisherExecutorService;
}

ExecutorService consumerExecutorService() {
return this.consumerExecutorService;
}

ScheduledExecutorService scheduledExecutorService() {
return this.scheduledExecutorService;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class AmqpEnvironmentBuilder implements EnvironmentBuilder {
private ExecutorService executorService;
private ScheduledExecutorService scheduledExecutorService;
private ExecutorService publisherExecutorService;
private ExecutorService consumerExecutorService;
private MetricsCollector metricsCollector = NoOpMetricsCollector.INSTANCE;
private ObservationCollector observationCollector = Utils.NO_OP_OBSERVATION_COLLECTOR;

Expand Down Expand Up @@ -82,15 +81,18 @@ public AmqpEnvironmentBuilder publisherExecutorService(ExecutorService publisher
}

/**
* Set executor service used for consumer loops.
* Deprecated, do not use anymore. Consumers do not use a polling loop anymore.
*
* <p>Set executor service used for consumer loops.
*
* <p>The library uses sensible defaults, override only in case of problems.
*
* @param consumerExecutorService the executor service
* @return this builder instance
* @deprecated Do not use anymore
*/
@Deprecated(forRemoval = true)
public AmqpEnvironmentBuilder consumerExecutorService(ExecutorService consumerExecutorService) {
this.consumerExecutorService = consumerExecutorService;
return this;
}

Expand Down Expand Up @@ -144,7 +146,6 @@ public Environment build() {
executorService,
scheduledExecutorService,
publisherExecutorService,
consumerExecutorService,
connectionSettings,
metricsCollector,
observationCollector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ static void initAll() {
null,
null,
null,
null,
connectionSettings,
NoOpMetricsCollector.INSTANCE,
Utils.NO_OP_OBSERVATION_COLLECTOR);
Expand Down