remove check for old implementation of Akka Discovery (#189)

This commit is contained in:
PJ Fanning 2023-02-15 15:23:18 +01:00 committed by GitHub
parent fd932032cd
commit 4e1da1e8e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,8 +24,6 @@ import pekko.annotation.InternalApi
final class Discovery(implicit system: ExtendedActorSystem) extends Extension {
Discovery.checkClassPathForOldDiscovery(system)
private val implementations = new ConcurrentHashMap[String, ServiceDiscovery]
private val factory = new JFunction[String, ServiceDiscovery] {
override def apply(method: String): ServiceDiscovery = createServiceDiscovery(method)
@ -119,22 +117,4 @@ object Discovery extends ExtensionId[Discovery] with ExtensionIdProvider {
override def createExtension(system: ExtendedActorSystem): Discovery = new Discovery()(system)
/**
* INTERNAL API
*/
@InternalApi
private[pekko] def checkClassPathForOldDiscovery(system: ExtendedActorSystem): Unit = {
try {
system.dynamicAccess.getClassFor[Any]("org.apache.pekko.discovery.SimpleServiceDiscovery").get
throw new RuntimeException(
"Old version of Akka Discovery from Akka Management found on the classpath. Remove `com.lightbend.pekko.discovery:akka-discovery` from the classpath..")
} catch {
case _: ClassCastException =>
throw new RuntimeException(
"Old version of Akka Discovery from Akka Management found on the classpath. Remove `com.lightbend.pekko.discovery:akka-discovery` from the classpath..")
case _: ClassNotFoundException =>
// all good
}
}
}