This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git
The following commit(s) were added to refs/heads/main by this push:
new 08d3896310 remove old deprecated dns code (#2023)
08d3896310 is described below
commit 08d38963103f5f3f1cf2276deb35b7eea26300ab
Author: PJ Fanning <[email protected]>
AuthorDate: Sun Aug 10 08:52:41 2025 +0100
remove old deprecated dns code (#2023)
* remove old deprecated dns code
* remove test that uses old deprecated and now removed code
* Update DnsCompileOnlyDocSpec.scala
* Update remove-deprecated-methods.excludes
* mima
* try to fix docs
* more issues
---
.../io/dns/internal/AsyncDnsManagerSpec.scala | 19 -----
.../remove-deprecated-methods.excludes | 10 +++
actor/src/main/scala/org/apache/pekko/io/Dns.scala | 83 +---------------------
.../apache/pekko/io/InetAddressDnsResolver.scala | 25 -------
.../scala/org/apache/pekko/io/SimpleDnsCache.scala | 26 +------
.../org/apache/pekko/io/SimpleDnsManager.scala | 11 +--
.../pekko/io/dns/internal/AsyncDnsManager.scala | 22 +-----
docs/src/main/paradox/io-dns.md | 13 +---
docs/src/main/paradox/stream/operators/index.md | 1 -
.../docs/actor/io/dns/DnsCompileOnlyDocSpec.scala | 16 +++--
.../scala/org/apache/pekko/io/DnsSpec.scala | 74 -------------------
.../scala/org/apache/pekko/stream/io/TcpSpec.scala | 8 ---
.../remove-deprecated-methods.excludes | 9 +++
.../apache/pekko/stream/StreamTcpException.scala | 3 -
14 files changed, 34 insertions(+), 286 deletions(-)
diff --git
a/actor-tests/src/test/scala/org/apache/pekko/io/dns/internal/AsyncDnsManagerSpec.scala
b/actor-tests/src/test/scala/org/apache/pekko/io/dns/internal/AsyncDnsManagerSpec.scala
index 4995f1196d..e11ba2c0e3 100644
---
a/actor-tests/src/test/scala/org/apache/pekko/io/dns/internal/AsyncDnsManagerSpec.scala
+++
b/actor-tests/src/test/scala/org/apache/pekko/io/dns/internal/AsyncDnsManagerSpec.scala
@@ -13,12 +13,8 @@
package org.apache.pekko.io.dns.internal
-import java.net.InetAddress
-
import scala.collection.immutable.Seq
-import scala.annotation.nowarn
-
import org.apache.pekko
import pekko.io.Dns
import pekko.io.dns.AAAARecord
@@ -27,8 +23,6 @@ import pekko.io.dns.DnsProtocol.{ Resolve, Resolved }
import pekko.testkit.{ ImplicitSender, PekkoSpec }
import pekko.testkit.WithLogCapturing
-// tests deprecated DNS API
-@nowarn("msg=deprecated")
class AsyncDnsManagerSpec extends PekkoSpec("""
pekko.loglevel = DEBUG
pekko.loggers = ["org.apache.pekko.testkit.SilenceAllTestEventListener"]
@@ -39,12 +33,6 @@ class AsyncDnsManagerSpec extends PekkoSpec("""
val dns = Dns(system).manager
"Async DNS Manager" must {
- "adapt reply back to old protocol when old protocol Dns.Resolve is
received" in {
- dns ! pekko.io.Dns.Resolve("127.0.0.1") // 127.0.0.1 will short circuit
the resolution
- val oldProtocolReply = pekko.io.Dns.Resolved("127.0.0.1",
InetAddress.getByName("127.0.0.1") :: Nil)
- expectMsg(oldProtocolReply)
- }
-
"support ipv6" in {
dns ! Resolve("::1") // ::1 will short circuit the resolution
expectMsgType[Resolved] match {
@@ -53,13 +41,6 @@ class AsyncDnsManagerSpec extends PekkoSpec("""
}
}
- "support ipv6 also using the old protocol" in {
- dns ! pekko.io.Dns.Resolve("::1") // ::1 will short circuit the
resolution
- val resolved = expectMsgType[pekko.io.Dns.Resolved]
- resolved.ipv4 should be(Nil)
- resolved.ipv6.length should be(1)
- }
-
"provide access to cache" in {
dns ! AsyncDnsManager.GetCache
((expectMsgType[pekko.io.SimpleDnsCache]: pekko.io.SimpleDnsCache)
should be).theSameInstanceAs(Dns(system).cache)
diff --git
a/actor/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
b/actor/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
index 1837e5e143..d0ad462cd9 100644
---
a/actor/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
+++
b/actor/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
@@ -38,6 +38,16 @@
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.dispatch.Execution
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.event.LogMarker.extractFromMDC")
ProblemFilters.exclude[MissingTypesProblem]("org.apache.pekko.event.Logging$StandardOutLogger")
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.event.jul.*")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.io.Dns.cached")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.io.Dns.resolve")
+ProblemFilters.exclude[MissingFieldProblem]("org.apache.pekko.io.Dns.Resolve")
+ProblemFilters.exclude[MissingFieldProblem]("org.apache.pekko.io.Dns.Resolved")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.io.Dns$Resolve")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.io.Dns$Resolve$")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.io.Dns$Resolved")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.io.Dns$Resolved$")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.io.SimpleDnsCache.cached")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.io.SimpleDnsManager.oldApis")
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.io.InetAddressDnsResolver.positiveTtl")
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.io.InetAddressDnsResolver.negativeTtl")
ProblemFilters.exclude[MissingFieldProblem]("org.apache.pekko.io.Tcp.WriteFile")
diff --git a/actor/src/main/scala/org/apache/pekko/io/Dns.scala
b/actor/src/main/scala/org/apache/pekko/io/Dns.scala
index c728e525a2..5aacd722a8 100644
--- a/actor/src/main/scala/org/apache/pekko/io/Dns.scala
+++ b/actor/src/main/scala/org/apache/pekko/io/Dns.scala
@@ -13,12 +13,10 @@
package org.apache.pekko.io
-import java.net.{ Inet4Address, Inet6Address, InetAddress,
UnknownHostException }
+import java.net.{ Inet4Address, Inet6Address, InetAddress }
import java.util.concurrent.ConcurrentHashMap
import java.util.function.{ Function => JFunction }
-import scala.collection.immutable
-
import scala.annotation.nowarn
import com.typesafe.config.Config
@@ -27,10 +25,7 @@ import pekko.actor._
import pekko.annotation.DoNotInherit
import pekko.annotation.InternalApi
import pekko.event.Logging
-import pekko.io.dns.AAAARecord
-import pekko.io.dns.ARecord
import pekko.io.dns.DnsProtocol
-import pekko.routing.ConsistentHashingRouter.ConsistentHashable
import pekko.util.ccompat._
import pekko.util.unused
@@ -43,26 +38,6 @@ import pekko.util.unused
@DoNotInherit
abstract class Dns {
- /**
- * Lookup if a DNS resolved is cached. The exact behavior of caching will
depend on
- * the pekko.actor.io.dns.resolver that is configured.
- */
- @deprecated("Use cached(DnsProtocol.Resolve)", "Akka 2.6.0")
- def cached(@unused name: String): Option[Dns.Resolved] = None
-
- /**
- * If an entry is cached return it immediately. If it is not then
- * trigger a resolve and return None.
- */
- @deprecated("Use resolve(DnsProtocol.Resolve)", "Akka 2.6.0")
- def resolve(name: String)(system: ActorSystem, sender: ActorRef):
Option[Dns.Resolved] = {
- // doesn't delegate to new method as sender is expecting old protocol back
- val ret = cached(name)
- if (ret.isEmpty)
- IO(Dns)(system).tell(Dns.Resolve(name), sender)
- ret
- }
-
def cached(@unused request: DnsProtocol.Resolve):
Option[DnsProtocol.Resolved] = None
def resolve(request: DnsProtocol.Resolve, system: ActorSystem, sender:
ActorRef): Option[DnsProtocol.Resolved] = {
@@ -76,62 +51,6 @@ abstract class Dns {
object Dns extends ExtensionId[DnsExt] with ExtensionIdProvider {
sealed trait Command
- @deprecated("Use cached(DnsProtocol.Resolve)", "Akka 2.6.0")
- case class Resolve(name: String) extends Command with ConsistentHashable {
- override def consistentHashKey = name
- }
-
- @deprecated("Use cached(DnsProtocol.Resolved)", "Akka 2.6.0")
- case class Resolved(name: String, ipv4: immutable.Seq[Inet4Address], ipv6:
immutable.Seq[Inet6Address])
- extends Command {
- val addrOption: Option[InetAddress] =
IpVersionSelector.getInetAddress(ipv4.headOption, ipv6.headOption)
-
- @throws[UnknownHostException]
- def addr: InetAddress = addrOption match {
- case Some(ipAddress) => ipAddress
- case None => throw new UnknownHostException(name)
- }
- }
-
- @deprecated("Use cached(DnsProtocol.Resolved)", "Akka 2.6.0")
- object Resolved {
- def apply(name: String, addresses: Iterable[InetAddress]): Resolved = {
- val ipv4: immutable.Seq[Inet4Address] =
- addresses.iterator.collect { case a: Inet4Address => a
}.to(immutable.IndexedSeq)
- val ipv6: immutable.Seq[Inet6Address] =
- addresses.iterator.collect { case a: Inet6Address => a
}.to(immutable.IndexedSeq)
- Resolved(name, ipv4, ipv6)
- }
-
- @deprecated("Use cached(DnsProtocol.Resolve)", "Akka 2.6.0")
- def apply(newProtocol: DnsProtocol.Resolved): Resolved = {
- Resolved(newProtocol.name,
- newProtocol.records.collect {
- case r: ARecord => r.ip
- case r: AAAARecord => r.ip
- })
- }
- }
-
- /**
- * Lookup if a DNS resolved is cached. The exact behavior of caching will
depend on
- * the pekko.actor.io.dns.resolver that is configured.
- */
- @deprecated("use cached(DnsProtocol.Resolve)", "Akka 2.6.0")
- def cached(name: String)(system: ActorSystem): Option[Resolved] = {
- Dns(system).cache.cached(name)
- }
-
- /**
- * If an entry is cached return it immediately. If it is not then
- * trigger a resolve and return None.
- */
- @deprecated("use resolve(DnsProtocol.Resolve)", "Akka 2.6.0")
- @nowarn("msg=deprecated")
- def resolve(name: String)(system: ActorSystem, sender: ActorRef):
Option[Resolved] = {
- Dns(system).cache.resolve(name)(system, sender)
- }
-
/**
* Lookup if a DNS resolved is cached. The exact behavior of caching will
depend on
* the pekko.actor.io.dns.resolver that is configured.
diff --git
a/actor/src/main/scala/org/apache/pekko/io/InetAddressDnsResolver.scala
b/actor/src/main/scala/org/apache/pekko/io/InetAddressDnsResolver.scala
index df81b22905..7e74dbfd7e 100644
--- a/actor/src/main/scala/org/apache/pekko/io/InetAddressDnsResolver.scala
+++ b/actor/src/main/scala/org/apache/pekko/io/InetAddressDnsResolver.scala
@@ -23,7 +23,6 @@ import scala.collection.immutable
import scala.concurrent.duration._
import scala.util.{ Failure, Success, Try }
-import scala.annotation.nowarn
import com.typesafe.config.Config
import org.apache.pekko
@@ -44,7 +43,6 @@ import pekko.util.Helpers.Requiring
*
* Respects the settings that can be set on the Java runtime via parameters.
*/
-@nowarn("msg=deprecated")
@InternalApi
class InetAddressDnsResolver(cache: SimpleDnsCache, config: Config) extends
Actor with ActorLogging {
@@ -137,29 +135,6 @@ class InetAddressDnsResolver(cache: SimpleDnsCache,
config: Config) extends Acto
}
}
sender() ! answer
- case Dns.Resolve(name) =>
- // no where in pekko now sends this message, but supported until
Dns.Resolve/Resolved have been removed
- val answer: Dns.Resolved = cache.cached(name) match {
- case Some(a) => a
- case None =>
- try {
- val addresses = InetAddress.getAllByName(name)
- // respond with the old protocol as the request was the new
protocol
- val answer = Dns.Resolved(name, addresses)
- if (positiveCachePolicy != Never) {
- val records = addressToRecords(name, addresses.toList, ipv4 =
true, ipv6 = true)
- cache.put((name, Ip()), DnsProtocol.Resolved(name, records),
positiveCachePolicy)
- }
- answer
- } catch {
- case _: UnknownHostException =>
- val answer = Dns.Resolved(name, immutable.Seq.empty,
immutable.Seq.empty)
- if (negativeCachePolicy != Never)
- cache.put((name, Ip()), DnsProtocol.Resolved(name,
immutable.Seq.empty), negativeCachePolicy)
- answer
- }
- }
- sender() ! answer
}
private def addressToRecords(
diff --git a/actor/src/main/scala/org/apache/pekko/io/SimpleDnsCache.scala
b/actor/src/main/scala/org/apache/pekko/io/SimpleDnsCache.scala
index b9239ab35d..c175aee614 100644
--- a/actor/src/main/scala/org/apache/pekko/io/SimpleDnsCache.scala
+++ b/actor/src/main/scala/org/apache/pekko/io/SimpleDnsCache.scala
@@ -18,18 +18,15 @@ import java.util.concurrent.atomic.AtomicReference
import scala.annotation.tailrec
import scala.collection.immutable
-import scala.annotation.nowarn
-
import org.apache.pekko
import pekko.actor.NoSerializationVerificationNeeded
import pekko.annotation.InternalApi
-import pekko.io.dns.{ AAAARecord, ARecord }
import pekko.io.dns.CachePolicy.CachePolicy
import pekko.io.dns.CachePolicy.Forever
import pekko.io.dns.CachePolicy.Never
import pekko.io.dns.CachePolicy.Ttl
import pekko.io.dns.DnsProtocol
-import pekko.io.dns.DnsProtocol.{ Ip, RequestType, Resolved }
+import pekko.io.dns.DnsProtocol.{ RequestType, Resolved }
private[io] trait PeriodicCacheCleanup {
def cleanup(): Unit
@@ -45,27 +42,6 @@ class SimpleDnsCache extends Dns with PeriodicCacheCleanup
with NoSerializationV
private val nanoBase = System.nanoTime()
- /**
- * Gets any IPv4 and IPv6 cached entries.
- * To get Srv or just one type use DnsProtocol
- *
- * This method is deprecated and involves a copy from the new protocol to
- * remain compatible
- */
- @nowarn("msg=deprecated")
- override def cached(name: String): Option[Dns.Resolved] = {
- // adapt response to the old protocol
- val ipv4 = cacheRef.get().get((name, Ip(ipv6 =
false))).toList.flatMap(_.records)
- val ipv6 = cacheRef.get().get((name, Ip(ipv4 =
false))).toList.flatMap(_.records)
- val both = cacheRef.get().get((name, Ip())).toList.flatMap(_.records)
- val all = (ipv4 ++ ipv6 ++ both).collect {
- case r: ARecord => r.ip
- case r: AAAARecord => r.ip
- }
- if (all.isEmpty) None
- else Some(Dns.Resolved(name, all))
- }
-
override def cached(request: DnsProtocol.Resolve):
Option[DnsProtocol.Resolved] =
cacheRef.get().get((request.name, request.requestType))
diff --git a/actor/src/main/scala/org/apache/pekko/io/SimpleDnsManager.scala
b/actor/src/main/scala/org/apache/pekko/io/SimpleDnsManager.scala
index 2d6d9a4bfa..f7692278b8 100644
--- a/actor/src/main/scala/org/apache/pekko/io/SimpleDnsManager.scala
+++ b/actor/src/main/scala/org/apache/pekko/io/SimpleDnsManager.scala
@@ -20,8 +20,6 @@ import pekko.actor.{ Actor, ActorLogging, Deploy, Props }
import pekko.dispatch.{ RequiresMessageQueue, UnboundedMessageQueueSemantics }
import pekko.routing.FromConfig
-import scala.annotation.nowarn
-
final class SimpleDnsManager(val ext: DnsExt)
extends Actor
with RequiresMessageQueue[UnboundedMessageQueueSemantics]
@@ -48,15 +46,8 @@ final class SimpleDnsManager(val ext: DnsExt)
system.scheduler.scheduleWithFixedDelay(interval, interval, self,
SimpleDnsManager.CacheCleanup)
}
- @nowarn("cat=deprecation")
- val oldApis: Receive = {
- case r @ Dns.Resolve(name) =>
- log.debug("(deprecated) Resolution request for {} from {}", name,
sender())
- resolver.forward(r)
- }
-
// the inet resolver supports the old and new DNS APIs
- override def receive: Receive = oldApis.orElse {
+ override def receive: Receive = {
case m: dns.DnsProtocol.Resolve =>
log.debug("Resolution request for {} from {}", m.name, sender())
resolver.forward(m)
diff --git
a/actor/src/main/scala/org/apache/pekko/io/dns/internal/AsyncDnsManager.scala
b/actor/src/main/scala/org/apache/pekko/io/dns/internal/AsyncDnsManager.scala
index 21c9b41bfe..e016eba314 100644
---
a/actor/src/main/scala/org/apache/pekko/io/dns/internal/AsyncDnsManager.scala
+++
b/actor/src/main/scala/org/apache/pekko/io/dns/internal/AsyncDnsManager.scala
@@ -19,7 +19,6 @@ import java.util.concurrent.TimeUnit
import scala.concurrent.ExecutionContextExecutor
import scala.concurrent.duration.Duration
-import scala.annotation.nowarn
import com.typesafe.config.Config
import org.apache.pekko
@@ -28,7 +27,7 @@ import pekko.annotation.InternalApi
import pekko.dispatch.{ RequiresMessageQueue, UnboundedMessageQueueSemantics }
import pekko.io.{ Dns, DnsExt, DnsProvider }
import pekko.io.PeriodicCacheCleanup
-import pekko.io.dns.{ AAAARecord, ARecord, DnsProtocol, DnsSettings }
+import pekko.io.dns.{ DnsProtocol, DnsSettings }
import pekko.io.dns.internal.AsyncDnsManager.CacheCleanup
import pekko.routing.FromConfig
import pekko.util.Timeout
@@ -47,7 +46,6 @@ private[pekko] object AsyncDnsManager {
* INTERNAL API
*/
@InternalApi
-@nowarn("msg=deprecated")
private[io] final class AsyncDnsManager(
name: String,
system: ExtendedActorSystem,
@@ -59,8 +57,6 @@ private[io] final class AsyncDnsManager(
with RequiresMessageQueue[UnboundedMessageQueueSemantics]
with ActorLogging
with Timers {
- import pekko.pattern.ask
- import pekko.pattern.pipe
/**
* Ctr expected by the DnsExt for all DnsMangers
@@ -101,27 +97,11 @@ private[io] final class AsyncDnsManager(
}
}
- // still support deprecated DNS API
- @nowarn("msg=deprecated")
override def receive: Receive = {
case r: DnsProtocol.Resolve =>
log.debug("Resolution request for {} {} from {}", r.name, r.requestType,
sender())
resolver.forward(r)
- case Dns.Resolve(name) =>
- // adapt legacy protocol to new protocol and back again, no where in
pekko
- // sends this message but supported until the old messages are removed
- log.debug("(deprecated) Resolution request for {} from {}", name,
sender())
- val adapted = DnsProtocol.Resolve(name)
- val reply = (resolver ? adapted).mapTo[DnsProtocol.Resolved].map {
asyncResolved =>
- val ips = asyncResolved.records.collect {
- case a: ARecord => a.ip
- case a: AAAARecord => a.ip
- }
- Dns.Resolved(asyncResolved.name, ips)
- }
- reply.pipeTo(sender())
-
case CacheCleanup =>
cacheCleanup.foreach(_.cleanup())
diff --git a/docs/src/main/paradox/io-dns.md b/docs/src/main/paradox/io-dns.md
index c81cba907d..37f56935db 100644
--- a/docs/src/main/paradox/io-dns.md
+++ b/docs/src/main/paradox/io-dns.md
@@ -53,18 +53,7 @@ Scala
Java
: @@snip
[DnsCompileOnlyDocTest.java](/docs/src/test/java/jdocs/actor/io/dns/DnsCompileOnlyDocTest.java)
{ #resolve }
-Alternatively the `IO(Dns)` actor can be interacted with directly. However
this exposes the different protocols of the DNS provider.
-`inet-adddress` uses `Dns.Resolve` and `Dns.Resolved` where as the `async-dns`
uses `DnsProtocol.Resolve` and `DnsProtocol.Resolved`.
-The reason for the difference is `inet-address` predates `async-dns` and
`async-dns` exposes additional information such as SRV records
-and it wasn't possible to evolve the original API in a backward compatible way.
-
-Inet-Address API:
-
-Scala
-: @@snip
[IODocSpec.scala](/docs/src/test/scala/docs/actor/io/dns/DnsCompileOnlyDocSpec.scala)
{ #actor-api-inet-address }
-
-Java
-: @@snip
[DnsCompileOnlyDocTest.java](/docs/src/test/java/jdocs/actor/io/dns/DnsCompileOnlyDocTest.java)
{ #actor-api-inet-address }
+Alternatively the `IO(Dns)` actor can be interacted with directly. `async-dns`
protocol uses `DnsProtocol.Resolve` and `DnsProtocol.Resolved`.
Async-DNS API:
diff --git a/docs/src/main/paradox/stream/operators/index.md
b/docs/src/main/paradox/stream/operators/index.md
index 1ebecd5b48..120cc91df0 100644
--- a/docs/src/main/paradox/stream/operators/index.md
+++ b/docs/src/main/paradox/stream/operators/index.md
@@ -17,7 +17,6 @@ These built-in sources are available from
@scala[`org.apache.pekko.stream.scalad
|Source|<a name="failed"></a>@ref[failed](Source/failed.md)|Fail directly with
a user specified exception.|
|Source|<a
name="from"></a>@ref[@scala[apply]@java[from]](Source/from.md)|Stream the
values of an @scala[`immutable.Seq`]@java[`Iterable`].|
|Source|<a name="fromarray"></a>@ref[fromArray](Source/fromArray.md)|Stream
the values of an `array`.|
-|Source|<a
name="fromcompletionstage"></a>@ref[fromCompletionStage](Source/fromCompletionStage.md)|Deprecated
by @ref[`Source.completionStage`](Source/completionStage.md).|
|Source|<a
name="fromiterator"></a>@ref[fromIterator](Source/fromIterator.md)|Stream the
values from an `Iterator`, requesting the next value when there is demand.|
|Source|<a
name="fromjavastream"></a>@ref[fromJavaStream](Source/fromJavaStream.md)|Stream
the values from a Java 8 `Stream`, requesting the next value when there is
demand.|
|Source|<a
name="frompublisher"></a>@ref[fromPublisher](Source/fromPublisher.md)|Integration
with Reactive Streams, subscribes to a
@javadoc[Publisher](java.util.concurrent.Flow.Publisher).|
diff --git a/docs/src/test/scala/docs/actor/io/dns/DnsCompileOnlyDocSpec.scala
b/docs/src/test/scala/docs/actor/io/dns/DnsCompileOnlyDocSpec.scala
index 13422938f7..804785aaf6 100644
--- a/docs/src/test/scala/docs/actor/io/dns/DnsCompileOnlyDocSpec.scala
+++ b/docs/src/test/scala/docs/actor/io/dns/DnsCompileOnlyDocSpec.scala
@@ -29,16 +29,20 @@ object DnsCompileOnlyDocSpec {
implicit val timeout: Timeout = Timeout(1.second)
val actorRef: ActorRef = ???
- // #resolve
- val initial: Option[Dns.Resolved] =
Dns(system).cache.resolve("google.com")(system, actorRef)
- val cached: Option[Dns.Resolved] = Dns(system).cache.cached("google.com")
- // #resolve
+
+ {
+ // #resolve
+ val resolve = DnsProtocol.Resolve("google.com",
DnsProtocol.ipRequestType())
+ val initial: Option[DnsProtocol.Resolved] = Dns.resolve(resolve, system,
actorRef)
+ val cached: Option[DnsProtocol.Resolved] = Dns.cached(resolve)(system)
+ // #resolve
+ }
{
// #actor-api-inet-address
- val resolved: Future[Dns.Resolved] = (IO(Dns) ?
Dns.Resolve("google.com")).mapTo[Dns.Resolved]
+ val resolved: Future[DnsProtocol.Resolved] =
+ (IO(Dns) ? DnsProtocol.Resolve("google.com")).mapTo[DnsProtocol.Resolved]
// #actor-api-inet-address
-
}
{
diff --git a/remote-tests/src/multi-jvm/scala/org/apache/pekko/io/DnsSpec.scala
b/remote-tests/src/multi-jvm/scala/org/apache/pekko/io/DnsSpec.scala
deleted file mode 100644
index 2a918f22f3..0000000000
--- a/remote-tests/src/multi-jvm/scala/org/apache/pekko/io/DnsSpec.scala
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2017-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-package org.apache.pekko.io
-
-import java.net.Inet4Address
-import java.net.Inet6Address
-import java.net.InetAddress
-
-import scala.annotation.nowarn
-
-import org.apache.pekko
-import pekko.remote.RemotingMultiNodeSpec
-import pekko.remote.testkit.MultiNodeConfig
-
-object DnsSpec extends MultiNodeConfig {
- val first = role("first")
-}
-
-class DnsSpecMultiJvmNode1 extends DnsSpec
-
-// This is a multi-jvm tests because it is modifying global System.properties
-@nowarn("msg=deprecated")
-class DnsSpec extends RemotingMultiNodeSpec(DnsSpec) {
-
- def initialParticipants = roles.size
-
- val ip4Address = InetAddress.getByAddress("localhost", Array[Byte](127, 0,
0, 1)) match {
- case address: Inet4Address => address
- case _ => fail()
- }
- val ipv6Address =
- InetAddress.getByAddress("localhost", Array[Byte](0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1)) match {
- case address: Inet6Address => address
- case _ => fail()
- }
-
- var temporaryValue: Option[String] = None
-
- override def atStartup(): Unit = {
- temporaryValue = sys.props.get("java.net.preferIPv6Addresses")
- }
-
- override def afterTermination(): Unit = {
- temporaryValue match {
- case Some(value) => sys.props.put("java.net.preferIPv6Addresses", value)
- case _ => sys.props.remove("java.net.preferIPv6Addresses")
- }
- }
-
- "Dns" must {
-
- "resolve to a IPv6 address if it is the preferred network stack" in {
- sys.props.put("java.net.preferIPv6Addresses", true.toString)
- Dns.Resolved("test", List(ip4Address), List(ipv6Address)).addr should
===(ipv6Address)
- }
- "resolve to a IPv4 address if IPv6 is not the preferred network stack" in {
- sys.props.remove("java.net.preferIPv6Addresses")
- Dns.Resolved("test", List(ip4Address), List(ipv6Address)).addr should
===(ip4Address)
- }
-
- }
-
-}
diff --git
a/stream-tests/src/test/scala/org/apache/pekko/stream/io/TcpSpec.scala
b/stream-tests/src/test/scala/org/apache/pekko/stream/io/TcpSpec.scala
index 7ba6e0539f..673629f2bf 100644
--- a/stream-tests/src/test/scala/org/apache/pekko/stream/io/TcpSpec.scala
+++ b/stream-tests/src/test/scala/org/apache/pekko/stream/io/TcpSpec.scala
@@ -77,16 +77,8 @@ class NonResolvingDnsManager(ext: pekko.io.DnsExt) extends
Actor {
}
}
-@nowarn("msg=deprecated")
class FailingDnsResolver extends DnsProvider {
override val cache: Dns = new Dns {
- override def cached(name: String): Option[Dns.Resolved] = None
- override def resolve(name: String)(system: ActorSystem, sender: ActorRef):
Option[Dns.Resolved] = {
- // tricky impl detail this is actually where the resolve response is
triggered
- // we fake that it fails directly from here
- sender ! Dns.Resolved(name, immutable.Seq.empty, immutable.Seq.empty)
- None
- }
override def cached(request: DnsProtocol.Resolve):
Option[DnsProtocol.Resolved] = None
override def resolve(
request: DnsProtocol.Resolve,
diff --git
a/stream/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
b/stream/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
index fcb63d87ca..a6d57bf826 100644
---
a/stream/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
+++
b/stream/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
@@ -28,6 +28,15 @@
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.Acto
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.ActorMaterializerSettings.withDebugLogging")
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.ActorMaterializerSettings.withMaxFixedBufferSize")
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.ActorMaterializerSettings.withBlockingIoDispatcher")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.stream.BindFailedException$")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.BindFailedException.canEqual")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.BindFailedException.fromProduct")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.BindFailedException.productIterator")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.BindFailedException.productElementNames")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.BindFailedException.productElementName")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.BindFailedException.productElement")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.BindFailedException.productArity")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.BindFailedException.productPrefix")
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.stream.FanInShape1N")
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.IOSettings.create")
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.IOSettings.apply")
diff --git
a/stream/src/main/scala/org/apache/pekko/stream/StreamTcpException.scala
b/stream/src/main/scala/org/apache/pekko/stream/StreamTcpException.scala
index 69887e1174..0c9c171fa4 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/StreamTcpException.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/StreamTcpException.scala
@@ -19,7 +19,4 @@ class StreamTcpException(msg: String) extends
RuntimeException(msg) with NoStack
class BindFailedException extends StreamTcpException("bind failed")
-@deprecated("BindFailedException object will never be thrown. Match on the
class instead.", "Akka 2.4.19")
-case object BindFailedException extends BindFailedException
-
class ConnectionException(msg: String) extends StreamTcpException(msg)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]