From 352eeccfbb0278318ba0d0b3dec8752f47d0eac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=99=8E=E9=B8=A3?= Date: Mon, 27 Jul 2026 13:02:49 +0800 Subject: [PATCH] deprecate BalancingDispatcherConfigurator and mark as internal API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Motivation: BalancingDispatcher has been deprecated since Akka 2.3 with the recommendation to use BalancingPool instead. The configurator class remained public and unmarked. Since Pekko 2.0.0 is a major release, it is time to deprecate and restrict visibility. Modification: - Add @deprecated annotation to BalancingDispatcherConfigurator - Mark the class as private[pekko] (INTERNAL API) - Add @nowarn to BalancingPool which uses it internally - Update Scaladoc to indicate INTERNAL API Result: BalancingDispatcherConfigurator is no longer part of the public API. BalancingPool continues to work as the supported replacement. Users who referenced the configurator by full class name in config will see deprecation warnings at compile time if they use it directly in code. Tests: - sbt "actor-tests/Test/testOnly org.apache.pekko.actor.dispatch.BalancingDispatcherSpec org.apache.pekko.actor.dispatch.DispatchersSpec org.apache.pekko.actor.ActorConfigurationVerificationSpec" — 33 tests passed - sbt "actor-tests/Test/testOnly org.apache.pekko.actor.dispatch.BalancingDispatcherModelSpec" — 10 tests passed - sbt "actor-tests/Test/testOnly org.apache.pekko.actor.ActorMailboxSpec" — 33 tests passed - sbt "actor/mimaReportBinaryIssues" — no issues References: Refs #3384, Refs #2168 --- .../main/scala/org/apache/pekko/dispatch/Dispatchers.scala | 5 ++++- .../src/main/scala/org/apache/pekko/routing/Balancing.scala | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/actor/src/main/scala/org/apache/pekko/dispatch/Dispatchers.scala b/actor/src/main/scala/org/apache/pekko/dispatch/Dispatchers.scala index 4c43a2f12b..b35dd9dfd9 100644 --- a/actor/src/main/scala/org/apache/pekko/dispatch/Dispatchers.scala +++ b/actor/src/main/scala/org/apache/pekko/dispatch/Dispatchers.scala @@ -319,12 +319,15 @@ private[pekko] object BalancingDispatcherConfigurator { } /** + * INTERNAL API + * * Configurator for creating `BalancingDispatcher`. * Returns the same dispatcher instance for each invocation * of the `dispatcher()` method. */ +@deprecated("Use BalancingPool instead of BalancingDispatcherConfigurator", "Pekko 2.0.0") @nowarn("msg=deprecated") -class BalancingDispatcherConfigurator(_config: Config, _prerequisites: DispatcherPrerequisites) +private[pekko] class BalancingDispatcherConfigurator(_config: Config, _prerequisites: DispatcherPrerequisites) extends MessageDispatcherConfigurator(BalancingDispatcherConfigurator.amendConfig(_config), _prerequisites) { private val instance = { diff --git a/actor/src/main/scala/org/apache/pekko/routing/Balancing.scala b/actor/src/main/scala/org/apache/pekko/routing/Balancing.scala index 309001dd4b..cfa996f803 100644 --- a/actor/src/main/scala/org/apache/pekko/routing/Balancing.scala +++ b/actor/src/main/scala/org/apache/pekko/routing/Balancing.scala @@ -79,6 +79,7 @@ private[pekko] final class BalancingRoutingLogic extends RoutingLogic { * @param routerDispatcher dispatcher to use for the router head actor, which handles * supervision, death watch and router management messages */ +@nowarn("msg=deprecated") @SerialVersionUID(1L) final case class BalancingPool( nrOfInstances: Int,